I have a kubernetes cluster on GCP, in which I have a elasticsearch service.
I have a elasticsearch-0
pod which is running a docker container of elasticsearch.
~ ❯❯❯ kubectl describe pod elasticsearch-0
Name: elasticsearch-0
Namespace: default
Node: gke-jaeger-persistent-st-default-pool-xxxxx-phvx/10.166.0.4
Start Time: Mon, 07 Jan 2019 14:21:19 +0100
Labels: app=jaeger-elasticsearch
controller-revision-hash=elasticsearch-8684f69799
jaeger-infra=elasticsearch-replica
statefulset.kubernetes.io/pod-name=elasticsearch-0
Annotations: kubernetes.io/limit-ranger: LimitRanger plugin set: cpu request for container elasticsearch
Status: Running
IP: 10.36.2.27
Controlled By: StatefulSet/elasticsearch
Containers:
elasticsearch:
Container ID: docker://5212b8c223401355bd29a5639caea5097074a8a8101ceb10300f76465e4a6536
Image: docker.elastic.co/elasticsearch/elasticsearch:5.6.0
Image ID: docker-pullable://docker.elastic.co/elasticsearch/elasticsearch@sha256:f95e7d4256197a9bb866b166d9ad37963dc7c5764d6ae6400e551f4987a659d7
Port: <none>
Host Port: <none>
Command:
And I need access to the node which manage my pod in order to get the container ID of my elasticsearch container.
I get the name of my instances with gcloud compute instances list
and enter via gcloud compute ssh <node-name> --zone=<zone-name>
command and I've enter to the elasticsearch docker container with root privileges docker exec -it -u root containerID bash
(following these steps)
I need perform this because I need add a new mountPath named /jaeger-data
in order to associate it to a persistent volume claim that I have prepared.
I enter to my docker container and create the mountPath
[root@elasticsearch-0 elasticsearch]# mkdir /jaeger-data
[root@elasticsearch-0 elasticsearch]#
But I can see that I am disconnecting continously from my docker container because the containerID
is changed of a continous way.
Each time that I enter to my node to get my containerID
with docker ps -a
command, this containerID
is different and when enter to the new container making use of the new ID, my /jaeger-data
mountPath is not found, this mean that there isn't, may be because I am entering to a new container ...
What is the reason to my containerID change all time? Is this related with Kubernetes node that contain my pod which have my elasticsearch docker container?
Is related with the Service situation?
Kubernetes Pods are mortal. They are born and when they die, they are not resurrected. ReplicaSets in particular create and destroy Pods dynamically (e.g. when scaling out or in). While each Pod gets its own IP address, even those IP addresses cannot be relied upon to be stable over time. This leads to a problem: if some set of Pods (let’s call them backends) provides functionality to other Pods (let’s call them frontends) inside the Kubernetes cluster, how do those frontends find out and keep track of which backends are in that set?
Enter Services.
How to can I address this situation?
I need create my mountPath in order to associate it to my elasticsearch-0
pod configuration