k8s 简单操作
kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s.node0.fanruan Ready control-plane 471d v1.24.2
k8s.node1.fanruan Ready <none> 471d v1.24.2
k8s.node2.fanruan Ready <none> 471d v1.24.2
k8s.node3.fanruan Ready <none> 471d v1.24.2
kubectl describe node [name]
Namespace Name CPU Requests CPU Limits Memory Requests Memory Limits Age
--------- ---- ------------ ---------- --------------- ------------- ---
guozi bi6-0 500m (3%) 16 (100%) 0 (0%) 0 (0%) 134d
kubectl exec -it [name] -n [namespace]
kubectl exec -ti bi6-0 -n guozi -- /bin/sh
kubectl get pod -n [namespace]
NAME READY STATUS RESTARTS AGE
bi6-0 1/1 Running 0 17m
kubectl get pod [name] -n [namespace] -o yaml > pod.yaml
输出 yaml 到 pod 文件中
kubectl describe pod -n [namespace]
Mounts:
/usr/local/tomcat/webapps/webroot/WEB-INF/customLib from bi6-data (rw,path="customLib")
Volumes:
bi6-data:
Type: PersistentVolumeClaim (a reference to a PersistentVolumeClaim in the same namespace)
ClaimName: bi6-data-bi6-0
ReadOnly: false
kubectl get pv
NAME | CAPACITY | CLAIM | |
---|---|---|---|
pvc-e9d57330-f2b6-43c6-b24b-78cf69281fb0 | 1Gi | guozi/bi6-data-bi6-0 |
这里 name 就是挂载的的路径 /data/pvc-xxx