I have 2 pods running in my kubernates cluster. One is simple a wordpress application and the 2nd one contains a mysql DB. Now wordpress is communicating with mysql DB.
I want to find this dependancies between pods. Is there any kubectl command or any tool like prometheus by which I can find dependancies between pods inside kubernates cluster?
No, there is no native kubernetes primitive which can define dependencies between pods. An easy thing you can do is to define labels like dependsOn
and attach them to the corresponding pod.
For example, your wordpress
pod can have a label which says dependsOn: mysql
where mysql
can either be the name or another label of your mysql
pod.
But this will only help a human reader understand what this pod is dependent on. Kubernetes works on the principle of eventual consistency. Even if mysql doesn't start before wordpress, eventually they will start working together and system will become consistent. The wordpress pod will crash when it cannot find mysql and Kubernetes will keep restarting crashing pods.
If you want to define dependencies between applications on Kubernetes and require deployments to happen in a particular order etc. you can take a look at tools like Aptomi.