POD操作

2019-12-25  本文已影响0人  xuxin2020

在master节点上创建yml文件

apiVersion: v1
kind: Pod
metadata:
     name: nginx
     labels:
        app: web
spec:
    containers:
      - name: nginx
        image: nginx
        ports:
          - containerPort: 80

执行create 命令创建pod

kubectl create -f k8s_pod.yml 

查看结果

NAME    READY   STATUS    RESTARTS   AGE   IP             NODE    NOMINATED NODE   READINESS GATES
nginx   1/1     Running   0          33m   10.100.6.130   node1   <none>           <none>

删除pod

[root@master test] kubectl delete pod nginx

命令小结:

1.创建
kubectl create -f xxx.yml
2.简单查询
kubectl get pods
3.查询详细
kubectl get pods -o wide
4.查询某个pod 详情
kubectl get pods nginx -o wide
5.根据lable查询
kubectl get pods nginx -o wide -l app=web
6.查询详细信息
kubectl describe pods
7.删除pod
kubectl delete pod nginx
8.替换pod镜像
kubectl replace --force -f xxx.yml

上一篇下一篇

猜你喜欢

热点阅读