English
« Back to projectatomic.io
Ask Your Question
0

How set command at json pod file?

asked 2015-01-08 19:49:35 +0000

pwFoo gravatar image

I have a fedora atomic host and try to create a centos container / pod via kubernates. How could a set a start command like /bin/bash ?

Here my pod file

{
"id": "mysql01",
"kind": "Pod",
"apiVersion": "v1beta1",
"labels": {
  "name": "mysql01"
},
"desiredState": {
  "manifest": {
    "version": "v1beta1",
    "id": "mysql01",
    "containers": [{
      "name": "mysql01",
      "image": "centos",
      "ports": [{
        "name": "mysql01",
        "containerPort": 3306,
      }]
   }]
  }
 }
}

And the error message:

kubelet.go:773] Error running pod mysql01.default.etcd container mysql01: API error (500): No command specified

I added a "command" to the container section, but it was ignored or thrown an error. How to set the command?

edit retag flag offensive close merge delete

2 answers

Sort by ยป oldest newest most voted
0

answered 2015-01-15 17:53:33 +0000

That's a Docker API error, kuberenetes is trying to schedule a Docker image that doesn't have a CMD or ENTRYPOINT..

If you are trying to launch the official CentOS Docker image, I believe that is a base image used for building other images. You could try the existing Docker hub mysql image instead, or that 'centos' image needs to be something locally that is pre-built and ready to run MySQL.

edit flag offensive delete link more
0

answered 2015-01-15 19:53:03 +0000

jasonbrooks gravatar image

updated 2015-01-15 19:56:19 +0000

This will work:

{
  "id": "mysql01",
  "kind": "Pod",
  "apiVersion": "v1beta1",
  "desiredState": {
    "manifest": {
      "version": "v1beta1",
      "id": "mysql01",
      "containers": [{
          "name": "mysql01",
          "image": "centos",
          "command": ["printenv"],
          "ports": [{
              "name": "mysql01",
              "containerPort": 6379
          }]
        }]
      }
    },
  "labels": {
    "name": "mysql01"
  }
}

And then you could run kubectl log -f mysql01 to see the result of that printenv command.

There's a mariadb container for CentOS 7 here. You could run that, figure out which minion it's on, and then use docker exec -ti CONTAINERID bash to enter that container.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Question Tools

Follow
1 follower

Stats

Asked: 2015-01-08 19:49:35 +0000

Seen: 6,430 times

Last updated: Jan 15 '15