📜  kubernetes 命令 - Shell-Bash 代码示例

📅  最后修改于: 2022-03-11 14:49:42.244000             🧑  作者: Mango

代码示例1
kubectl apply -f my-manifest.yaml      # create resource(s)
kubectl delete -f my-manifest.yaml  # delete resource(s)

kubectl get pods                # List all pods in the namespace
kubectl edit pods/    # Edit Pods 
kubectl describe svc/  # Describe a Services
kubectl logs          # logs from pod
kubectl port-forward svc/my-service 5000:my-service-port  # Forward Service target port to local port 5000
kubectl create deployment my-dep --image=nginx  # Create Deployment

kubectl get pods -o wide        # List all pods in ps output format with more information    
kubectl get pods --all-namespaces     # List all pods in all namespaces
kubectl get svc                  # List all services in the namespace
kubectl get nodes                # Get list Nodes in cluster
kubectl get ns                    # List Namespace
# All kubectl Commands
https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands
# Cheatsheet 
https://kubernetes.io/docs/reference/kubectl/cheatsheet/