1个pods 多个containers

举报
tscswcn 发表于 2019/03/24 22:52:01 2019/03/24
【摘要】 root@instance-21uc4fiv-1:~# kubectl get podsNAME READY STATUS RESTARTS AGEliveness-exec 1/1 Running 37 2hnginx-64f497f8fd-wvz62 ...

root@instance-21uc4fiv-1:~# kubectl get pods

NAME                          READY     STATUS    RESTARTS   AGE

liveness-exec                 1/1       Running   37         2h

nginx-64f497f8fd-wvz62        1/1       Running   0          2h

nginxredis-75fc96f96b-6pv5g   2/2       Running   0          23m

root@instance-21uc4fiv-1:~# kubectl exec -it nginxredis-75fc96f96b-6pv5g /bin/bash

Defaulting container name to redis.

Use 'kubectl describe pod/nginxredis-75fc96f96b-6pv5g -n default' to see all of the containers in this pod.

root@nginxredis-75fc96f96b-6pv5g:/data# ls

root@nginxredis-75fc96f96b-6pv5g:/data# cat /etc/hosts

# Kubernetes-managed hosts file.

127.0.0.1       localhost

::1     localhost ip6-localhost ip6-loopback

fe00::0 ip6-localnet

fe00::0 ip6-mcastprefix

fe00::1 ip6-allnodes

fe00::2 ip6-allrouters

172.16.2.6      nginxredis-75fc96f96b-6pv5g

root@nginxredis-75fc96f96b-6pv5g:/data# exit

exit

root@instance-21uc4fiv-1:~# kubectl exec -it nginxredis-75fc96f96b-6pv5g -c nginx /bin/bash

root@nginxredis-75fc96f96b-6pv5g:/# cat /etc/hosts

# Kubernetes-managed hosts file.

127.0.0.1       localhost

::1     localhost ip6-localhost ip6-loopback

fe00::0 ip6-localnet

fe00::0 ip6-mcastprefix

fe00::1 ip6-allnodes

fe00::2 ip6-allrouters

172.16.2.6      nginxredis-75fc96f96b-6pv5g

root@nginxredis-75fc96f96b-6pv5g:/# hostname

nginxredis-75fc96f96b-6pv5g

root@nginxredis-75fc96f96b-6pv5g:/# ps

bash: ps: command not found

root@nginxredis-75fc96f96b-6pv5g:/# exit

exit

command terminated with exit code 127

root@instance-21uc4fiv-1:~# kubectl exec -it nginxredis-75fc96f96b-6pv5g -c redis /bin/bash

root@nginxredis-75fc96f96b-6pv5g:/data#  cat /etc/hosts

# Kubernetes-managed hosts file.

127.0.0.1       localhost

::1     localhost ip6-localhost ip6-loopback

fe00::0 ip6-localnet

fe00::0 ip6-mcastprefix

fe00::1 ip6-allnodes

fe00::2 ip6-allrouters

172.16.2.6      nginxredis-75fc96f96b-6pv5g

root@nginxredis-75fc96f96b-6pv5g:/data# docker ps

bash: docker: command not found

root@nginxredis-75fc96f96b-6pv5g:/data# exit

exit

command terminated with exit code 127

root@instance-21uc4fiv-1:~#            

 

 

 

 

 

 

 

 

 

apiVersion: extensions/v1beta1

kind: Deployment

metadata:

  annotations:

    deployment.kubernetes.io/revision: "1"

  creationTimestamp: 2019-03-24T03:14:31Z

  generation: 1

  labels:

    run: nginx

  name: nginxredis

  namespace: default

  resourceVersion: "18270"

  selfLink: /apis/extensions/v1beta1/namespaces/default/deployments/nginx

  uid: f0f12438-4de2-11e9-b20d-fa163effceaa

spec:

  progressDeadlineSeconds: 600

  replicas: 1

  revisionHistoryLimit: 2

  selector:

    matchLabels:

      run: nginx

  strategy:

    rollingUpdate:

      maxSurge: 25%

      maxUnavailable: 25%

    type: RollingUpdate

  template:

    metadata:

      creationTimestamp: null

      labels:

        run: nginx

    spec:

      containers:                                    

      - image: redis

        imagePullPolicy: Always

        name: redis

        resources: {}

        terminationMessagePath: /dev/termination-log1

        terminationMessagePolicy: File

      - image: nginx

        imagePullPolicy: Always

        name: nginx

        resources: {}

        terminationMessagePath: /dev/termination-log

        terminationMessagePolicy: File

      dnsPolicy: ClusterFirst

      restartPolicy: Always

      schedulerName: default-scheduler

      securityContext: {}

      terminationGracePeriodSeconds: 30

status:

  availableReplicas: 1

  conditions:

  - lastTransitionTime: 2019-03-24T03:14:48Z

    lastUpdateTime: 2019-03-24T03:14:48Z

    message: Deployment has minimum availability.

    reason: MinimumReplicasAvailable

    status: "True"

    type: Available

  - lastTransitionTime: 2019-03-24T03:14:31Z

    lastUpdateTime: 2019-03-24T03:14:48Z

    message: ReplicaSet "nginx-64f497f8fd" has successfully progressed.

    reason: NewReplicaSetAvailable

    status: "True"       

    type: Progressing

  observedGeneration: 1

  readyReplicas: 1

  replicas: 1

  updatedReplicas: 1   


【版权声明】本文为华为云社区用户原创内容,转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息, 否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱: cloudbbs@huaweicloud.com
  • 点赞
  • 收藏
  • 关注作者

评论(0

0/1000
抱歉,系统识别当前为高风险访问,暂不支持该操作

全部回复

上滑加载中

设置昵称

在此一键设置昵称,即可参与社区互动!

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。

*长度不超过10个汉字或20个英文字符,设置后3个月内不可修改。