Kubernetes No external IP

6/24/2021

I installed kubernetes as a single node cluster on a Debian 10 Box. I changed the dashboard config with :

sudo kubectl -n kubernetes-dashboard edit svc kubernetes-dashboard 

and changed ClusterIP to NodePort and set the port to 32321. As described in this tutorial: https://k21academy.com/docker-kubernetes/kubernetes-dashboard/

sudo kubectl get svc kubernetes-dashboard -n kubernetes-dashboard
NAME                   TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)         AGE
kubernetes-dashboard   NodePort   10.100.91.194   <none>        443:32321/TCP   25m

I Still don't get any external IP and can't access the Dashboard via external ip :(

Any advice?

sudo kubectl get all --all-namespaces
NAMESPACE              NAME                                             READY   STATUS    RESTARTS   AGE
kube-system            pod/coredns-558bd4d5db-9fxkw                     1/1     Running   0          136m
kube-system            pod/coredns-558bd4d5db-bq79s                     1/1     Running   0          136m
kube-system            pod/etcd-dyd-001                                 1/1     Running   0          136m
kube-system            pod/kube-apiserver-dyd-001                       1/1     Running   0          136m
kube-system            pod/kube-controller-manager-dyd-001              1/1     Running   0          136m
kube-system            pod/kube-flannel-ds-amd64-hh5qm                  1/1     Running   0          136m
kube-system            pod/kube-proxy-4pg4r                             1/1     Running   0          136m
kube-system            pod/kube-scheduler-dyd-001                       1/1     Running   0          136m
kubernetes-dashboard   pod/dashboard-metrics-scraper-84f48697d6-6sqqt   1/1     Running   0          19m
kubernetes-dashboard   pod/kubernetes-dashboard-689fddb6b4-5sbhf        1/1     Running   0          19m

NAMESPACE              NAME                                TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                  AGE
default                service/kubernetes                  ClusterIP   10.96.0.1       <none>        443/TCP                  136m
kube-system            service/kube-dns                    ClusterIP   10.96.0.10      <none>        53/UDP,53/TCP,9153/TCP   136m
kubernetes-dashboard   service/dashboard-metrics-scraper   ClusterIP   10.98.66.248    <none>        8000/TCP                 19m
kubernetes-dashboard   service/kubernetes-dashboard        NodePort    10.100.91.194   <none>        443:32321/TCP            19m

NAMESPACE     NAME                                     DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR            AGE
kube-system   daemonset.apps/kube-flannel-ds-amd64     1         1         1       1            1           <none>                   136m
kube-system   daemonset.apps/kube-flannel-ds-arm       0         0         0       0            0           <none>                   136m
kube-system   daemonset.apps/kube-flannel-ds-arm64     0         0         0       0            0           <none>                   136m
kube-system   daemonset.apps/kube-flannel-ds-ppc64le   0         0         0       0            0           <none>                   136m
kube-system   daemonset.apps/kube-flannel-ds-s390x     0         0         0       0            0           <none>                   136m
kube-system   daemonset.apps/kube-proxy                1         1         1       1            1           kubernetes.io/os=linux   136m

NAMESPACE              NAME                                        READY   UP-TO-DATE   AVAILABLE   AGE
kube-system            deployment.apps/coredns                     2/2     2            2           136m
kubernetes-dashboard   deployment.apps/dashboard-metrics-scraper   1/1     1            1           19m
kubernetes-dashboard   deployment.apps/kubernetes-dashboard        1/1     1            1           19m

NAMESPACE              NAME                                                   DESIRED   CURRENT   READY   AGE
kube-system            replicaset.apps/coredns-558bd4d5db                     2         2         2       136m
kubernetes-dashboard   replicaset.apps/dashboard-metrics-scraper-84f48697d6   1         1         1       19m
kubernetes-dashboard   replicaset.apps/kubernetes-dashboard-689fddb6b4        1         1         1       19m

sudo kubectl get all -n kubernetes-dashboard
NAME                                             READY   STATUS    RESTARTS   AGE
pod/dashboard-metrics-scraper-84f48697d6-6sqqt   1/1     Running   0          17m
pod/kubernetes-dashboard-689fddb6b4-5sbhf        1/1     Running   0          17m

NAME                                TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)         AGE
service/dashboard-metrics-scraper   ClusterIP   10.98.66.248    <none>        8000/TCP        17m
service/kubernetes-dashboard        NodePort    10.100.91.194   <none>        443:32321/TCP   17m

NAME                                        READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/dashboard-metrics-scraper   1/1     1            1           17m
deployment.apps/kubernetes-dashboard        1/1     1            1           17m

NAME                                                   DESIRED   CURRENT   READY   AGE
replicaset.apps/dashboard-metrics-scraper-84f48697d6   1         1         1       17m
replicaset.apps/kubernetes-dashboard-689fddb6b4        1         1         1       17m

sudo kubectl get svc -n kubernetes-dashboard
NAME                        TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)         AGE
dashboard-metrics-scraper   ClusterIP   10.98.66.248    <none>        8000/TCP        15m
kubernetes-dashboard        NodePort    10.100.91.194   <none>        443:32321/TCP   15m

and

sudo kubectl get deployment kubernetes-dashboard -n kubernetes-dashboard
NAME                   READY   UP-TO-DATE   AVAILABLE   AGE
kubernetes-dashboard   1/1     1            1           17m

and

sudo kubectl describe service kubernetes-dashboard -n kubernetes-dashboard
Name:                     kubernetes-dashboard
Namespace:                kubernetes-dashboard
Labels:                   k8s-app=kubernetes-dashboard
Annotations:              <none>
Selector:                 k8s-app=kubernetes-dashboard
Type:                     NodePort
IP Family Policy:         SingleStack
IP Families:              IPv4
IP:                       10.100.91.194
IPs:                      10.100.91.194
Port:                     <unset>  443/TCP
TargetPort:               8443/TCP
NodePort:                 <unset>  32321/TCP
Endpoints:                10.244.0.6:8443
Session Affinity:         None
External Traffic Policy:  Cluster
Events:                   <none>
-- dev
kubernetes

1 Answer

6/25/2021

You will not see the External IP for a nodeport service.

Try accessing your dashboard with your server's public IP and port

https://<server_IP>:32321

Above, port 32321 is taken from your output

sudo kubectl get svc kubernetes-dashboard -n kubernetes-dashboard
NAME                   TYPE       CLUSTER-IP      EXTERNAL-IP   PORT(S)         AGE
kubernetes-dashboard   NodePort   10.100.91.194   <none>        443:32321/TCP   25m

Remember, to use https and that the port will change if you redeploy the service.

-- Rakesh Gupta
Source: StackOverflow