0

I have MAC M1 running Docker Desktop (v20.10.17). Kubernetes is NOT enabled, just the docker engine is running.

I installed Kind Cluster:

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
# Can add additional control planes
#- role: control-plane
#- role: control-plane
- role: control-plane
- role: worker
- role: worker
- role: worker

I then installed Metalllb using steps from https://kind.sigs.k8s.io/docs/user/loadbalancer/

I then deployed nginx: kubectl create deploy nginx --image nginx

If I port forward, I can reach nginx from the browser.

I then exposed my deployment as a Service of type LoadBalancer: kubectl expose deploy nginx --port 8080 --type LoadBalancer

Unfortunately if I try to access the Service via the External IP Address shown, I am not able to access nginx.

Please Advise.

Sibtain
  • 1,436
  • 21
  • 39
user1424876
  • 133
  • 1
  • 7

1 Answers1

0

LoadBalancers work by utilizing load balancers on cloud providers like GCP or AWS so a locally running Kind cluster would probably use a NodePort service instead of Loadbalancer in your deployment/StatefulSet to expose nginx but double check the options.

Currently working on a Kind deployment for Postgres and when I ran into similar issues with connectivity and port fowarding, the solution was to add a listen address to the Kind config file - in both cases the issue being to make service accessible outside of the cluster. I believe you can also expose an externalIP like below but test it out.

kind-config.yaml (some values from Postgres)

kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
  # port forward 5432 on the host to 5432 on this node
  extraPortMappings:
  - containerPort: 5432
    hostPort: 5432
    # optional: set the bind address on the host
    # 0.0.0.0 is the current default
    listenAddress: "127.0.0.1"
    # optional: set the protocol to one of TCP, UDP, SCTP.
    # TCP is the default
    protocol: TCP
networking:
  ipFamily: ipv4
  apiServerAddress: 192.168.1.175
  apiServerPort: 10000

JPSur
  • 1
  • 1