kubectl not communicating with minikube

2/24/2021

Learning kubernetes with kubectl and minikube locally. I can see this via kubectl:

> kubectl get all -o wide

NAME                                     READY   STATUS    RESTARTS   AGE   IP           NODE       NOMINATED NODE   READINESS GATES
pod/mongodb-deployment-8f6675bc5-tjwsb   1/1     Running   0          20s   10.1.43.14   chris-x1   <none>           <none>
pod/mongo-express-78fcf796b8-9gbsd       1/1     Running   0          20s   10.1.43.15   chris-x1   <none>           <none>

NAME                            TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)          AGE   SELECTOR
service/kubernetes              ClusterIP      10.152.183.1     <none>        443/TCP          29m   <none>
service/mongo-express-service   LoadBalancer   10.152.183.254   <pending>     8081:30000/TCP   20s   app=mongo-express
service/mongodb-service         ClusterIP      10.152.183.115   <none>        27017/TCP        20s   app=mongodb

NAME                                 READY   UP-TO-DATE   AVAILABLE   AGE   CONTAINERS      IMAGES          SELECTOR
deployment.apps/mongodb-deployment   1/1     1            1           20s   mongodb         mongo           app=mongodb
deployment.apps/mongo-express        1/1     1            1           21s   mongo-express   mongo-express   app=mongo-express

NAME                                           DESIRED   CURRENT   READY   AGE   CONTAINERS      IMAGES          SELECTOR
replicaset.apps/mongodb-deployment-8f6675bc5   1         1         1       20s   mongodb         mongo           app=mongodb,pod-template-hash=8f6675bc5
replicaset.apps/mongo-express-78fcf796b8       1         1         1       21s   mongo-express   mongo-express   app=mongo-express,pod-template-hash=78fcf796b8

But when I lanuch minikube dashboard I don't see any pods, deployments, services etc...? Its like they are running off of different clusters. If I paste the YAML configs directly into minikube dashboard, then I can see everything. So strange... Why?

I can use the minikube kubectl command, but that doesn't seem like thats how this should work.

Running Ubuntu 20, kubectl 1.20, and minikube 1.17.

-- cnizzardini
kubectl
kubernetes
minikube

1 Answer

2/24/2021

Turns out I was set to run off of microk8s-cluster instead of minikube.

chris@chris-x1 /v/w/p/k8s> kubectl config view

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: DATA+OMITTED
    server: https://127.0.0.1:16443
  name: microk8s-cluster
contexts:
- context:
    cluster: microk8s-cluster
    user: admin
  name: microk8s
current-context: microk8s
kind: Config
preferences: {}
users:
- name: admin
  user:
    token: REDACTED

So I needed to follow these steps to access a dashboard: https://microk8s.io/docs/addon-dashboard

-- cnizzardini
Source: StackOverflow