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