4

イメージが異なる 2 つのコンテナーを含む kubernetes ポッドを作成して、両方のコンテナーを一緒に起動できるようにしたいと考えています。

現在、次の構成を試しました。

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

ただし、実行するkubecfg -c app.json create /podsと次のエラーが発生します。

F0909 08:40:13.028433 01141 kubecfg.go:283] Got request error: request [&http.Request{Method:"POST", URL:(*url.URL)(0xc20800ee00), Proto:"HTTP/1.1", ProtoMajor:1, ProtoMinor:1, Header:http.Header{}, B
ody:ioutil.nopCloser{Reader:(*bytes.Buffer)(0xc20800ed20)}, ContentLength:396, TransferEncoding:[]string(nil), Close:false, Host:"127.0.0.1:8080", Form:url.Values(nil), PostForm:url.Values(nil), Multi
partForm:(*multipart.Form)(nil), Trailer:http.Header(nil), RemoteAddr:"", RequestURI:"", TLS:(*tls.ConnectionState)(nil)}] failed (500) 500 Internal Server Error: {"kind":"Status","creationTimestamp":
null,"apiVersion":"v1beta1","status":"failure","message":"failed to find fit for api.Pod{JSONBase:api.JSONBase{Kind:\"\", ID:\"SSH podId\", CreationTimestamp:util.Time{Time:time.Time{sec:63545848813, nsec
:0x14114e1, loc:(*time.Location)(0xb9a720)}}, SelfLink:\"\", ResourceVersion:0x0, APIVersion:\"\"}, Labels:map[string]string{\"name\":\"imageTest\"}, DesiredState:api.PodState{Manifest:api.ContainerMa
nifest{Version:\"v1beta1\", ID:\"podId\", Volumes:[]api.Volume(nil), Containers:[]api.Container{api.Container{Name:\"type1\", Image:\"local/image\", Command:[]string(nil), WorkingDir:\"\", Ports:[]ap
i.Port(nil), Env:[]api.EnvVar(nil), Memory:0, CPU:0, VolumeMounts:[]api.VolumeMount(nil), LivenessProbe:(*api.LivenessProbe)(nil)}, api.Container{Name:\"type2\", Image:\"local/secondary\", Command:[]string(n
il), WorkingDir:\"\", Ports:[]api.Port(nil), Env:[]api.EnvVar(nil), Memory:0, CPU:0, VolumeMounts:[]api.VolumeMount(nil), LivenessProbe:(*api.LivenessProbe)(nil)}}}, Status:\"\", Host:\"\", HostIP:\"\
", PodIP:\"\", Info:api.PodInfo(nil), RestartPolicy:api.RestartPolicy{Type:\"RestartAlways\"}}, CurrentState:api.PodState{Manifest:api.ContainerManifest{Version:\"\", ID:\"\", Volumes:[]api.Volume(nil
), Containers:[]api.Container(nil)}, Status:\"\", Host:\"\", HostIP:\"\", PodIP:\"\", Info:api.PodInfo(nil), RestartPolicy:api.RestartPolicy{Type:\"\"}}}","code":500}

それに応じて構成を変更するにはどうすればよいですか?

vagrant vm (yungsang/coreos) で kubernetes を実行しています。

4

3 に答える 3

2

ここで問題となっているエラーは、「適合が見つかりませんでした」です。これは通常、ポートの競合がある場合に発生します (同じhostPortものを何度も使用しようとするか、ワーカー ノード/ミニオンがない可能性があります。

Kubernetes が非常に活発に開発されているため、Kubernetes git リポジトリ ( http://kubernetes.ioを参照) にある Vagrant ファイルを使用することをお勧めします。CoreOS の単一マシンのセットアップで動作させたい場合は、IRC (#google-containers on freenode) にアクセスして、Kelsey Hightower に連絡してみてください。

于 2014-09-09T23:44:25.023 に答える
2

ポッド スペック ファイルが無効のようです。http://kubernetes.io/v1.0/docs/user-guide/walkthrough/README.html#multiple-containersによると、有効な複数コンテナー ポッドの仕様は次のようになります。

apiVersion: v1
kind: Pod
metadata:
  name: www
spec:
  containers:
  - name: nginx
    image: nginx
    volumeMounts:
    - mountPath: /srv/www
      name: www-data
      readOnly: true
  - name: git-monitor
    image: kubernetes/git-monitor
    env:
    - name: GIT_REPO
      value: http://github.com/some/repo.git
    volumeMounts:
    - mountPath: /data
      name: www-data
  volumes:
  - name: www-data
    emptyDir: {}

http://kubernetes.io/docs/user-guide/walkthrough/#multiple-containersにある最新のドキュメント

于 2015-07-29T07:14:34.003 に答える
1
apiVersion: v1
kind: Pod
metadata:
 name: test
spec:
 containers:
 - name: wp
   image: wordpress
   resources: 
    requests:
     memory: "64Mi"
     cpu: "250m" 
    limits:
     memory: "128Mi"
     cpu: "500m"
 - name: ng
   image: nginx
   imagePullPolicy: IfNotPresent
于 2019-01-31T09:26:12.080 に答える