查询节点node
kubectl get node
查询节点标签
kubectl get node --show-labels
查询所有pod
kubectl get pod -A
查询指定命名空间下的pod
kubectl get pod -n project-3428
查询pod详细
kubectl -n project-3428 get pod xxxxxxxxxxxx -o wide
POD打标签
kubectl label pod mypod app=web
查看资源quota
> kubectl get quota -n project-12786
NAME AGE REQUEST LIMIT
resourcequota-12786 9d persistentvolumeclaims: 0/50, requests.cpu: 0/1, requests.memory: 0/1Gi, requests.storage: 0/3Gi limits.cpu: 0/1, limits.memory: 0/1Gi
> kubectl get resourcequota -n project-12786
NAME AGE REQUEST LIMIT
resourcequota-12786 9d persistentvolumeclaims: 0/50, requests.cpu: 0/1, requests.memory: 0/1Gi, requests.storage: 0/3Gi limits.cpu: 0/1, limits.memory: 0/1Gi
查看存储类sc
kubectl get sc
查看存储卷PV
kubectl get pv
查看存储卷声明PVC
kubectl -n project-3428 get pvc
查看存储快照类
kubectl get vs -A
kubectl get volumesnapshotclass
查看存储快照
kubectl get volumesnapshot -n 命名空间
查看存储快照yaml
kubectl get volumesnapshot 具体的 -n 命名空间 -o yaml
查询指定命名空间的secret
kubectl get secret -n sc用的命名空间
查看kubevirt虚拟机组,vmpool
kubectl -n project-3524 get virtualmachinepool
kubectl -n project-3524 get virtualmachinepool vp-100
kubectl -n project-3524 get virtualmachinepool vp-100 -o yaml
查看vm虚拟机
kubectl get vm -n project-3428
查看vmi镜像
kubectl get vmi -n project-3428
强制删除pod
kubectl delete pod newhuodai-0 --force --grace-period=0
kubectl delete -f busybox-two.yaml --force
kubectl delete pod -n default nginx-two-765d6fd96d-2csd2
查看csi驱动
> kubectl get csidriver
NAME ATTACHREQUIRED PODINFOONMOUNT STORAGECAPACITY TOKENREQUESTS REQUIRESREPUBLISH MODES AGE
cephfs.csi.ceph.com true false false <unset> false Persistent 14d
local.csi.com false false false <unset> false Persistent 14d
rbd.csi.ceph.com true false false <unset> false Persistent 14d
kubectl get csidrivers
查询endpoint
kubectl get endpoint -n project-3429
查询service
kubectl get svc -n 命名空间
pod扩缩容
kubectl apply -f nginx.yaml
kubectl get pod -n default -o wide
kubectl get deployment -n default
kubectl scale deployment/nginx-100 --replicas=100 -n default
kubectl scale deployment/nginx-100 --replicas=1 -n default
kubectl get pod -n default | grep Running | wc -l
获取configmap
kubectl get cm coredns -n kube-system -o yaml
进入pod内部
kubectl exec -it calico-node-qz54v -n kube-system bash
查看deployment
kubectl get deployment -n csi-driver
编辑deployment
kubectl edit deployment csi-controller -n csi-driver