fix: use NodePort for registry — resolvable from node host network

This commit is contained in:
Falkan
2026-03-19 01:27:16 -04:00
parent 5901ba92e8
commit 8e739f4077
3 changed files with 7 additions and 19 deletions

View File

@@ -5,29 +5,18 @@
set -euo pipefail
TAG="${1:-latest}"
# In-cluster address — how the deployment manifest references the image
REGISTRY="registry.registry.svc.cluster.local:5000"
# Use a node IP:NodePort — resolvable from both dev machine and cluster nodes
REGISTRY="${REGISTRY:-<NODE_IP>:30500}"
IMAGE="$REGISTRY/humor-units:$TAG"
echo "==> Port-forwarding registry (localhost:5000 -> in-cluster registry)..."
kubectl port-forward -n registry svc/registry 5000:5000 &
PF_PID=$!
trap "kill $PF_PID 2>/dev/null" EXIT
sleep 2
echo "==> Building $IMAGE..."
buildah build \
--format docker \
--tag "$IMAGE" \
"$(dirname "$0")"
echo "==> Pushing via port-forward (localhost:5000)..."
# Push to localhost:5000 (the port-forward tunnel) but with the in-cluster tag.
# buildah push accepts a separate destination so we don't retag.
buildah push \
--tls-verify=false \
"$IMAGE" \
"docker://localhost:5000/humor-units:$TAG"
echo "==> Pushing $IMAGE..."
buildah push --tls-verify=false "$IMAGE"
echo "==> Restarting humor-units deployment..."
kubectl rollout restart deployment/humor-units -n default

View File

@@ -16,7 +16,7 @@ spec:
spec:
containers:
- name: humor-units
image: registry.registry.svc.cluster.local:5000/humor-units:latest
image: <NODE_IP>:30500/humor-units:latest
imagePullPolicy: Always
ports:
- containerPort: 3000

View File

@@ -67,9 +67,8 @@ spec:
ports:
- port: 5000
targetPort: 5000
# ClusterIP is fine if you port-forward from dev machine to push.
# Change to NodePort or add an Ingress if you want external push access.
type: ClusterIP
nodePort: 30500
type: NodePort
---
apiVersion: v1
kind: Namespace