moonkop
moonkop

Reputation: 29

Why many pods share one docker container as node

admin@C02D842CML85 ~ % kubectl get pods -A -o wide

NAMESPACE     NAME                               READY   STATUS    RESTARTS        AGE     IP             NODE       NOMINATED NODE   READINESS GATES

kube-system   coredns-6d4b75cb6d-d6d4j           1/1     Running   1 (4h31m ago)   2d20h   172.17.0.2     minikube   <none>           <none>


kube-system   etcd-minikube                      1/1     Running   2 (4h31m ago)   2d20h   192.168.49.2   minikube   <none>           <none>

kube-system   kube-apiserver-minikube            1/1     Running   2 (4h31m ago)   2d20h   192.168.49.2   minikube   <none>           <none>

kube-system   kube-controller-manager-minikube   1/1     Running   2 (4h31m ago)   2d20h   192.168.49.2   minikube   <none>           <none>

kube-system   kube-proxy-wlwxl                   1/1     Running   1 (4h31m ago)   2d20h   192.168.49.2   minikube   <none>           <none>

kube-system   kube-scheduler-minikube            1/1     Running   2 (4h31m ago)   2d20h   192.168.49.2   minikube   <none>           <none>

kube-system   storage-provisioner                1/1     Running   8 (4h30m ago)   2d20h   192.168.49.2   minikube   <none>           <none>

portainer     portainer-868cdb78c9-25w94         1/1     Running   0               5m34s   172.17.0.3     minikube   <none>           <none>

admin@C02D842CML85 ~ % docker ps -a

CONTAINER ID   IMAGE                                 COMMAND                  CREATED      STATUS      PORTS                                                                                                                        NAMES

30609334facb   gcr.io/k8s-minikube/kicbase:v0.0.32   "/usr/local/bin/entr…"   2 days ago   Up 2 days   0.0.0.0:59308->22/tcp, 0.0.0.0:59309->2376/tcp, 0.0.0.0:59306->5000/tcp, 0.0.0.0:59307->8443/tcp, 0.0.0.0:59310->32443/tcp   minikube

As you can see ,there is only one docker container named minikube ,and there are may pods running on it, I was thinking that a k8s pod is made of several containers ,so there should be at least 8 docker containers.

It seems that docker container named minikube is used as a Node in k8s . Is k8s use docker container like a native machine and runs pods on it ? so one docker container contains many k8s containers?

Upvotes: 0

Views: 52

Answers (1)

vladtkachuk
vladtkachuk

Reputation: 741

Simply because minikube is a "simulation" of k8s. So the container you see is roughly a k8s cluster. And your pods are run inside it as separate containers (so to say containers-in-container).

Minikube is a lightweight Kubernetes implementation that creates a VM on your local machine and deploys a simple cluster containing only one node.

https://kubernetes.io/docs/tutorials/kubernetes-basics/create-cluster/cluster-intro/#:~:text=To%20get%20started%20with%20Kubernetes,%2C%20macOS%2C%20and%20Windows%20systems.

Upvotes: 2

Related Questions