赞
踩
目录
kubectl run pod1 --image=nginx -o yaml --dry-run=client > pod.yaml
apiVersion: v1kind: Podmetadata:creationTimestamp: nulllabels:run: pod1name: pod1spec:containers:- image: nginx # 主容器name: web- image: busybox # 辅助容器name: testcommand: ['/bin/sh','-c','sleep 24h']
kubectl apply -f pod.yaml
kubectl get pods
kubectl exec -it pod1 -c test -- sh
wget 127.0.0.1:80
kubectl exec -it pod1 -c web -- bash
kubectl get pods -o wide
docker ps |grep pod1
apiVersion: v1kind: Podmetadata:creationTimestamp: nulllabels:run: pod2name: pod2spec:containers:- image: nginx # 主容器name: webvolumeMounts:- name: logmountPath: /usr/share/nginx/html- image: busybox # 辅助容器name: testcommand: ['/bin/sh','-c','sleep 24h']volumeMounts: # 数据卷挂载- name: log # 指定挂载的数据卷名称mountPath: /data # 数据卷挂载到容器中的路径volumes: # 定义数据卷- name: log # 数据卷名称emptyDir: {} # 数据卷类型
kubectl apply -f pod2.yaml
kubectl exec -it pod2 -c web -- bash
kubectl exec -it pod2 -c test -- sh
apiVersion: v1kind: Podmetadata:name: my-podspec:containers:- name: container1image: nginx- name: container2image: centos
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。