connecting to Kubernetes kops pod using docker deamon

7/29/2019

I created Kubernetes cluster with kops (on AWS), and i want to access to one of my nodes as a root.According to this post, it's possible only with Docker command. When i type docker image ls i'm getting nothing. When i was using minikube i solved this issue with minikube docker-env and from output i just copied last line into new CMD line @FOR /f "tokens=*" %i IN ('minikube docker-env') DO @%i (I'm using Widnows 10) and using above procedure, after typing docker image ls or docker image ps i was able to see all minikube pods. Is there any way to do the same for pods created with kops ?

I'm able to do it connecting to Kubernetes node, install docker on it, and then i can connect to pod specifying -u root switch, but i wonder is it possible to do the same from host machine (Windows 10 in my case)

-- overflowed
docker
kops
kubernetes

2 Answers

7/30/2019

That is not possible. A pod is an abstraction created and managed by kubernetes. The docker daemon has no idea to what is a pod. You can only see the containers using docker command. But then again, you wont be able to tell which container is associated to which pod.

Answered by @Marc ABOUCHACRA

-- overflowed
Source: StackOverflow

7/29/2019

It's a bit unclear what you're trying to do. So I'm going to give some general info here based on this scenario : You've created a K8S cluster on AWS using Kops

I want to access one of my AWS node as root

This has nothing to do with kops nor it has with Docker. This is basic AWS management. You need to check on your AWS console management to get all the info to connect to your node.

I want to see all the docker image from my windows laptop

Again, this has nothing to do with kops. Kops is a Kubernetes distribution. In Kubernetes, the smallest units of computing that can be managed is the pod. You cannot manage directly docker containers or images with kubernetes.
So if you want to see your docker images, you'll need to somehow connect to your AWS node and then execute

docker image ls

In fact, that's what you're doing with your minikube example. You're just executing the docker command on the VM managed by minikube.

More info on what's a pod here

I want to see all the pods created with kops

Well, assuming that you've succesfully configured your system to access AWS with kops (more info on that here), then you'll just have to directly execute any kubectl command. For example, to list all the pods located in the kube-system namespace :

kubectl -n kube-system get po

Hope this helps !

-- Marc ABOUCHACRA
Source: StackOverflow