how to find directory of a kafka in pod in GCP? - docker

I'm using Kubernetes on Google Cloud Platform; I installed the Kafka image in a pod, but when I try to make communication between producer and consumer with Kafkacat nothing is working.
I want to find the directory kafka in pod.

The containers running inside a pod are actually run by the docker daemon (assuming docker is the chosen container runtime for this Kubernetes deployment) of the host machine.
So in case of GCP the host machine will be the worker VM where the pod is scheduled by Kubernetes.
You can get to know which worker VM by looking at the node by running the command:
kubectl get pod pod name -o wide
Hence the image will be stored in the file system of the host machine. The exact path depends on the OS distribution of the host machine.
This is discussed here Where are Docker images stored on the host machine?

Related

How to access `docker-compose` containers, in Minikube

Issue:
I want my web-server to have either a Kubernetes config and a Docker-Compose config.
I run them on a MacBook (no native containers support), so at the moment I
run docker-compose on Docker Desktop
run kubectl on a Minikube VM
(I stick to Minikube because of the convenient commands like minikube ip & minikube service, that I rely on in my scripts)
This makes slow and inconvenient to switch from one setup to the other (suspend Minikube, start Docker Desktop, rebuild the images, re-run the services; and vice-versa).
They won't share built images or containers, and they run in different environments.
Attempt
I tried running docker-compose on Docker from the Minikube VM.
Works fine, but I cannot connect to the service, because there is no tunnelling or port-forwarding from the Host machine to the Minikube machine
(while compose takes care of the inner forwarding from $(minikube ip):8081 to docker-container-webserver:8080.
Question
How to open the connection from the Host machine (browser) to the container (web-server) running inside Minikube?
I tried minikube tunnel but it didn't seem to help (it is designed to work with Kubernetes LoadBalancer services).

Using FlexVolume on local kubernetes cluster with docker-desktop

I'm trying to use flex volumes for mounting file server and key vault, respectively:
Git Repo
and Git Repo
However, mounting any of them cause pods needing them to get stuck in ContainerCreating with warning messages about being unable to mount volumes due to a timeout. There is a step in the configuration of non-aks clusters that requires adjusting configs, which seems to be impossible when using a docker-provided Kubernetes server.
Is it possible to install flex volume driver on the docker Kubernetes server, as outlined here config kubelet service to enable FlexVolume driver and if so, how to access the config files? And if not, is it at all possible to mount flex volume volumes when working locally using docker-desktop Kubernetes?
I've deployed the same configuration to the AKS cluster and it's working correctly.

connecting to Kubernetes kops pod using docker deamon

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)
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 !
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

Kubernetes in Docker for Windows

I have not installed minikube in my local windows machine.I have only used kubernetes in docker. Docker settings checked enable Kubernetes.Everthing is ok. I created a Pod and a Service succesfully.Finally I need to an ip different from localhost for accessing through browser.
http://I_need_an_ip:31515
What is equaliant minikube ip when use kubernetes in docker for windows, without minukube?
"kubectl describe node docker-for-desktop" gives you the internal IP address that the docker for desktop node is running on (see also Minikube vs Kubernetes in Docker for Windows )

Deploying local Docker image (DockerFIle) as local Kubernetes pod

I started Kubernetes master and minion on local machine using Vagrant. I can create a json file for my Kubernetes pod where I can start several public containers.
However, one Docker container is local one, ontop on java:8-jdk, configured with DockerFile.
How can I reference this local Docker container in the kubernetes json pod so Kubernetes can run it?
In other words, does Kubernetes support docker build ;)
After you build the docker image, you can "side-load" it into your locally available images by running docker load -i /path/to/image.tar. Once you've done this, Kubernetes will be able to load the image without reaching out to an external hub.

Resources