Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify the order Dockers run on Kubernetes pod

I am trying to run two Dockers on the same Kubernetes pod and I want one of the Docker container always to run before the other. I remember learning about specifying such dependency on the pod configuration file, but can not find that now. Kubernetes documentation does not explain it either.

Here is the example pod configuration with two containers I adopted from another Stackoverflow question. How should I change this pod configuration to run container type1 before type2?

{
  "id": "podId",
  "desiredState": {
    "manifest": {
      "version": "v1beta1",
      "id": "podId",
      "containers": [{
        "name": "type1",
        "image": "local/image"
        },
        {
        "name": "type2",
        "image": "local/secondary"
        }]
    }
  },
  "labels": {
    "name": "imageTest"
  }
}

Thanks in advance, Nodir.

like image 269
Nodir Kodirov Avatar asked Dec 30 '14 08:12

Nodir Kodirov


People also ask

How do I run a Docker container in Kubernetes cluster?

Download and install Docker Desktop as described in Orientation and setup. Work through containerizing an application in Part 2. Make sure that Kubernetes is enabled on your Docker Desktop: Mac: Click the Docker icon in your menu bar, navigate to Preferences and make sure there's a green light beside 'Kubernetes'.

How do I edit the running pod in Kubernetes?

Edit PODs and DeploymentsRun the kubectl edit pod <pod name> command. This will open the pod specification in an editor (vi editor). Then edit the required properties. When you try to save it, you will be denied.

Does Kubernetes run on top of Docker?

The Symbiosis Between Kubernetes and Docker Quite the contrary; Kubernetes can run without Docker and Docker can function without Kubernetes. But Kubernetes can (and does) benefit greatly from Docker and vice versa. Docker is a standalone software that can be installed on any computer to run containerized applications.


1 Answers

Kubernetes currently does not allow specification of container startup dependencies.

There has been some discussion in GitHub issues 1996 and 1589 that might help you out.

like image 60
CJ Cullen Avatar answered Nov 10 '22 11:11

CJ Cullen