0
votes

Issue: Running docker-for-mac & kubernetes, command kubectl get pods -namespace=kube-system does not list expected pods.


Experimenting with kubernetes & docker-for-mac. After following initial setup, I expect the output of the following command to list several pods (such as an etcd pod and a kube-proxy pod, etc)

╰─$ kubectl get pods -namespace=kube-system
No resources found.

I can verify that the actual containers themselves are running with the output of docker container ls

╰─$ docker container ls
CONTAINER ID        IMAGE                            COMMAND                  CREATED              STATUS              PORTS               NAMES
d7bfc959bb33        docker/kube-compose-controller   "/compose-controller…"   46 seconds ago       Up 46 seconds                           k8s_compose_compose-74649b4db6-xn46f_docker_f4dd8d7f-eeee-11e8-8e78-025000000001_0
2f01b7e2855f        k8s.gcr.io/pause-amd64:3.1       "/pause"                 53 seconds ago       Up 52 seconds                           k8s_POD_compose-74649b4db6-xn46f_docker_f4dd8d7f-eeee-11e8-8e78-025000000001_0
a54f5f5e0186        docker/kube-compose-api-server   "/api-server --kubec…"   54 seconds ago       Up 54 seconds                           k8s_compose_compose-api-5d6dcc4cbc-4r52t_docker_f00a7746-eeee-11e8-8e78-025000000001_0
1242642473b3        k8s.gcr.io/pause-amd64:3.1       "/pause"                 About a minute ago   Up About a minute                       k8s_POD_compose-api-5d6dcc4cbc-4r52t_docker_f00a7746-eeee-11e8-8e78-025000000001_0
ee49f5c45980        0dab2435c100                     "/dashboard --insecu…"   About a minute ago   Up About a minute                       k8s_kubernetes-dashboard_kubernetes-dashboard-7b9c7bc8c9-nslnw_kube-system_559631df-eeec-11e8-982b-025000000001_1
4cb9888194b9        6f7f2dc7fab5                     "/sidecar --v=2 --lo…"   About a minute ago   Up About a minute                       k8s_sidecar_kube-dns-86f4d74b45-5zssv_kube-system_2255e3e7-eeea-11e8-982b-025000000001_0
3ef054ac39a2        c2ce1ffb51ed                     "/dnsmasq-nanny -v=2…"   About a minute ago   Up About a minute                       k8s_dnsmasq_kube-dns-86f4d74b45-5zssv_kube-system_2255e3e7-eeea-11e8-982b-025000000001_0
6511e32e5255        80cc5ea4b547                     "/kube-dns --domain=…"   About a minute ago   Up About a minute                       k8s_kubedns_kube-dns-86f4d74b45-5zssv_kube-system_2255e3e7-eeea-11e8-982b-025000000001_1
98908ce56c77        k8s.gcr.io/pause-amd64:3.1       "/pause"                 About a minute ago   Up About a minute                       k8s_POD_kube-dns-86f4d74b45-5zssv_kube-system_2255e3e7-eeea-11e8-982b-025000000001_1
747fd0b06213        k8s.gcr.io/pause-amd64:3.1       "/pause"                 About a minute ago   Up About a minute                       k8s_POD_kubernetes-dashboard-7b9c7bc8c9-nslnw_kube-system_559631df-eeec-11e8-982b-025000000001_1
980b20ab8907        4261d315109d                     "/usr/local/bin/kube…"   About a minute ago   Up About a minute                       k8s_kube-proxy_kube-proxy-8tn9v_kube-system_221cf931-eeea-11e8-982b-025000000001_1
8592205bbda8        k8s.gcr.io/pause-amd64:3.1       "/pause"                 About a minute ago   Up About a minute                       k8s_POD_kube-proxy-8tn9v_kube-system_221cf931-eeea-11e8-982b-025000000001_1
dad3aea73e73        e03746fe22c3                     "kube-apiserver --ad…"   About a minute ago   Up About a minute                       k8s_kube-apiserver_kube-apiserver-docker-for-desktop_kube-system_456522cd0020e6485653eab412bf0586_2
4271813e4543        353b8f1d102e                     "kube-scheduler --le…"   About a minute ago   Up About a minute                       k8s_kube-scheduler_kube-scheduler-docker-for-desktop_kube-system_8c33750d637b5de93e891805153e7560_1
9770f8a8b22c        40c8d10b2d11                     "kube-controller-man…"   About a minute ago   Up About a minute                       k8s_kube-controller-manager_kube-controller-manager-docker-for-desktop_kube-system_f11db718cff79a1337ad4547ab74b891_2
dbd19772566f        52920ad46f5b                     "etcd --listen-clien…"   About a minute ago   Up About a minute                       k8s_etcd_etcd-docker-for-desktop_kube-system_d9b7a25d513fbfc6827c78cfa47d6daf_2
f1a19e2a8eac        k8s.gcr.io/pause-amd64:3.1       "/pause"                 About a minute ago   Up About a minute                       k8s_POD_kube-scheduler-docker-for-desktop_kube-system_8c33750d637b5de93e891805153e7560_2
9f388bea2f02        k8s.gcr.io/pause-amd64:3.1       "/pause"                 About a minute ago   Up About a minute                       k8s_POD_kube-controller-manager-docker-for-desktop_kube-system_f11db718cff79a1337ad4547ab74b891_2
98ca4df129b4        k8s.gcr.io/pause-amd64:3.1       "/pause"                 About a minute ago   Up About a minute                       k8s_POD_kube-apiserver-docker-for-desktop_kube-system_456522cd0020e6485653eab412bf0586_2
2bc4fd6d216c        k8s.gcr.io/pause-amd64:3.1       "/pause"                 About a minute ago   Up About a minute                       k8s_POD_etcd-docker-for-desktop_kube-system_d9b7a25d513fbfc6827c78cfa47d6daf_2

For verification, kubectl is pointed at my local kubernetes server

╰─$ kubectl config current-context
docker-for-desktop

Msc info

╰─$ kubectl cluster-info
Kubernetes master is running at https://localhost:6443
KubeDNS is running at https://localhost:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

╰─$ kubectl get nodes
NAME                 STATUS    ROLES     AGE       VERSION
docker-for-desktop   Ready     master    49m       v1.10.3
1
I am also facing a similar issue with the docker desktop even the right kubectl command fired. Did your issue got resolved?kannandreams

1 Answers

3
votes

The command you're using is incorrect, you should use:

kubectl get pods --namespace=kube-system

or

kubectl get pods -n kube-system

It will show you the pods.