1个pods 多个containers
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
- 点赞
- 收藏
- 关注作者
评论(0)