Home > Back-end >  K8s common commands
K8s common commands

Time:09-26

1. Check the node information
Kubectl get nodes - o wide
2.
configuration commands default namespaceKubectl config set - the context $(kubectl config current - context) - namespace=service - software
3. Copy file within the pod to external:
Kubectl cp itom - apm UI - 855447 dc64 - bd86m:/opt/itom/log/imcapmui. 2019-09-19. The/
4. Check the pod of resource state
Kubectl top pod - all - namespaces
5. Create a service
Kubectl create -f service_faultdm. Yaml
6. Check the service
Kubectl get service
7. Create a pod
Kubectl create -f deployment_netresdm. Yaml
8. Remove pod
Kubectl delete - f deployment_netresdm. Yaml
9. Check the operation of the pods
Kubectl get the pods - o wide
10. To view the pods details
Kubectl describe pod netresdm - 1187811333 - q09l5
11. Check the pods log
Kubectl logs netresdm - 1187811333 - q09l5
12. Remove pod
Kubectl delete the pods podname
Forced termination:
Kubectl delete pod kafka - 2-7 b8d644696-5 VBQQ -- grace - period=0 -- force
13. Enter the pod
Kubectl exec - it podname/bin/bash
14. Modify the warehouse address
Modify the vim/etc/sysconfig/docker configuration file, add the following content:
ADD_REGISTRY='- add - registry 172.21.3.20:5000'
INSECURE_REGISTRY='- insecure - registry 172.21.3.20:5000'

15. The console log output location:
Du - sh *
The/var/lib/docker/containers/077312 f541d3c6c4964e10bac2bfbbda9c90951644d4e27265f2bc7a6485de66

  • Related