Search code examples
kubernetesdebiancalicometallb

accessing Kubernetes from remote hosts


I'm pretty sure I have something misconfigured or missing something.

my home network is 10.11.0.0/16

I setup a kubernetes instance with

sudo kubeadm init --pod-network-cidr=10.166.0.0/16

Then I installed calico with

CALICO_IPV4POOL_CIDR=10.166.32.0/20

Then I setup MetalLB with

apiVersion: v1
kind: ConfigMap
metadata:
  namespace: metallb-system
  name: config
data:
  config: |
    address-pools:
    - name: default
      protocol: layer2
      addresses:
      - 192.168.100.1-192.168.100.254

I used the tutorial at https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/ using NodePort and it works fine on the kubernetes machine:

kubectl describe services example-service
Name:                     example-service
Namespace:                default
Labels:                   app.kubernetes.io/name=load-balancer-example
Annotations:              <none>
Selector:                 app.kubernetes.io/name=load-balancer-example
Type:                     NodePort
IP:                       10.110.245.152
Port:                     <unset>  8080/TCP
TargetPort:               8080/TCP
NodePort:                 <unset>  30140/TCP
Endpoints:                10.166.32.243:8080,10.166.32.244:8080,10.166.32.245:8080 + 2 more...
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>

I can access the pod on the kubernetes machine with

curl http://10.110.245.152:8080
Hello Kubernetes!

How to I enable other machines on my home network to access? When I try this on other machines it just hangs...

curl http://10.110.245.152:8080

Solution

  • shouldnt it be curl <kubernetes machine IP >:30140 if you are using NodePort service ?