Unable to connect internet on a docker container running on GKE pod - docker

We have a GKE pod running with Jenkins image having docker installed in it. When I tried to build a image using Dockerfile on this Jenkins GKE pod, It is not working as background containers created while building image from Dockerfile are unable to access internet to fetch data.

Related

Best way to export minikube cluster to a new machine

I have a fullstack application running in minikube cluster, i'm using docker as a minikube driver, and it's working perfectly, unfortunately i'm still new to kubernetes, how can i run this same cluster on a new machine, i'm loading local docker images of my app services to minikube.
I came up with this method:
Push all of my app images to docker hub
Export all my services and deployments as yaml files ( after modiying image pull source)
Install minikube on the new machine
Create a new cluster
Apply all declaration files
Exposing my frontend service
App can be accessed on localhost:someport
any suggestions of an easier way to achieve this?

CI/CD with Docker Compose on Google Cloud

I'm building a pipeline in Buddy where the application is build on command. New containers are build and pushed to DockerHub when it's time to deploy. I'm using Google's Container Optimized OS to run Docker Compose, this way. But I can't find a way to automatically refresh and pull the latest container from DockerHub within the Contianer Optimized OS on a running instance.
Any idea how this can be achieved?

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

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?

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

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