- kubectl get pods 查看pods:
[root@master ~]# kubectl get pods -l app=nginx
NAME READY STATUS RESTARTS AGE
nginx-deployment-7fc9b7bd96-8tt2g 1/1 Running 5 155d
nginx-deployment-7fc9b7bd96-cmt2g 1/1 Running 5 155d
[root@master ~]# kubectl get pods -n kube-system
NAME READY STATUS RESTARTS AGE
coredns-78fcdf6894-csv59 1/1 Running 9 175d
coredns-78fcdf6894-zpg62 1/1 Running 9 175d
etcd-master 1/1 Running 9 175d
kube-apiserver-master 1/1 Running 9 175d
kube-controller-manager-master 1/1 Running 9 175d
kube-proxy-bzv8m 1/1 Running 9 175d
kube-proxy-mnjb6 1/1 Running 0 40m
kube-scheduler-master 1/1 Running 9 175d
kubernetes-dashboard-767dc7d4d-kbhjq 1/1 Running 8 174d
weave-net-2ftfr 1/2 CrashLoopBackOff 11 40m
weave-net-pm6k4 2/2 Running 7 103d
- 应用yaml文件创建,更新pods:
kubectl apply -f nginx-deployment-volume.yaml
[root@master ~]# cat nginx-deployment-volume.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 2
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.8
ports:
- containerPort: 80
volumeMounts:
- mountPath: "/usr/share/nginx/html"
name: nginx-vol
volumes:
- name: nginx-vol
hostPath:
path: /var/data
- 删除yaml的pods:
kubectl delete -f nginx-deployment-volume.yaml
网友评论