registry: Use NodePort service for container-registry and expose it on host via k3d port mapping
diff --git a/apps/container-registry/install.yaml b/apps/container-registry/install.yaml
index 7eb5024..bec3383 100644
--- a/apps/container-registry/install.yaml
+++ b/apps/container-registry/install.yaml
@@ -10,12 +10,15 @@
name: registry
namespace: container-registry
spec:
- type: ClusterIP
+ # NOTE(lekva): We use NodePort type service here so container registry accessible
+ # from every node in the cluster without any extra whitelisting.
+ # It is easy to expose such services on host muchine from local dev environment.
+ type: NodePort
selector:
app: registry
ports:
- - nodePort:
- port: 5000
+ - port: 5000
+ nodePort: 30500
targetPort: 5000
---
apiVersion: networking.k8s.io/v1
diff --git a/dev/k3d.sh b/dev/k3d.sh
index 2f8b6a1..e407591 100755
--- a/dev/k3d.sh
+++ b/dev/k3d.sh
@@ -5,7 +5,8 @@
k3d cluster create pcloud-dev \
--servers=1 \
--k3s-server-arg="--disable=traefik" \
- --port="8080:80@loadbalancer"
+ --port="8080:80@loadbalancer" \
+ --port="30500:30500@server[0]"
k3d kubeconfig merge pcloud-dev --switch-context
# Traefik
@@ -17,11 +18,7 @@
--set ports.traefik.expose=True
# Container Registry
+## You ca build and push images from host machine to lcoal dev environment using:
+## docker build --tag=localhost:30500/foo/bar:latest .
+## docker push pcloud-localhost:30500/foo/bar:latest
kubectl apply -f $ROOT/apps/container-registry/install.yaml
-## Right now ingress on container registry does not work for some reason.
-## Use kubectl port-forward bellow to expose registry on localhost.
-## kubectl port-forward service/registry -n container-registry 8090:5000
-## And add "127.0.0.1 pcloud-dev-container-registry" to /etc/hosts
-## After that one can:
-## docker build --tag=pcloud-dev-container-registry:8090/foo/bar:latest .
-## docker push pcloud-dev-container-registry:8090/foo/bar:latest