kubectl
- kubectl describe node pend2
- kubectl cluster-info
- kubectl api-resources
- kubectl run nginx-deploy --image=nginx:1.14-alpine --port=80
- kubectl expose pod nginx-pod --name nginx-service --port=8080 --target-port=80 --protocol=TCP --type=ClusterIP
- kubectl create deployment nginx-deploy --image=nginx:1.14-alpine
- kubectl get pods -o wide
- kubectl expose deployment nginx-deployment --name nginx-service --port=8080 --target-port=80 --protocol=TCP --type=ClusterIP
- kubectl run client-pod --image=busybox -it
- dig @10.96.0.10 -t a nginx-service.default.svc.cluster.local
- kubectl dscribe service nginx-service
- kubectl get pods --show-labels
- kubectl edit service nginx-service
- kubectl delete service nginx-service
- kubectl create deployment nominate --image=ikubernetes/myapp:v1
- kubectl scale --current-replicas=1 --replicas=2 deployment/nominate
- kubectl describe pod nominate-559c6f4b55-6tjk2
- kubectl set image deployment nominate myapp=ikubernetes/myapp:v2
- kubectl rollout status deployment nominate
- kubectl rollout history deployment nominate
- kubectl rollout undo deployment nominate --to-revision=0 pods名称会改变,是pods销毁,重新生成的过程
- kubectl rollout undo deployment nominate --to-revision=0 来回切换
- kubectl edit svc nominate-svc
- kubectl get pod nominate-d44d647bd-8x7wr -o yaml
- kubectl api-versions
- kubectl explain pod.spec.containers.tty
- kubectl create -f pod-demo.yaml
- kubectl get pods -w
- kubectl logs pod-demo davent
- kubectl describe pod pod-demo -n default4
- kubectl exec pod/pod-demo -c advent -it -- /bin/sh
- kubectl delete pod pod-demo
- kubectl get pods --show-labels
- kubectl get pods -L app,tier 增加2列显示所有pods的app和iter标签的值
- kubectl get pods -l env --show-labels 显示有env标签的pods
- kubectl label -f pod-demo release=canary
- kubectl label pod pod-demo release=stable --overwirte
- kubectl get pods -l 'release in (canary,stable)'
- kubectl get pods -l '!release'
- kubectl label node pend2 disktype=ssd
- kubectl explain pod.spec.containers.livenessProbe.exec
- kubectl set image deployment stray-deploy stray-pod=ikubernetes/myapp:v3 && kubectl rollout pause deployment stray-deploy
- kubectl rollout status deployment stray-deploy
- kubectl rollout resume deployment stray-deploy
- kubectl get rs -o wide
- kubectl rollout history deployment stray-deploy
- kubectl rollout undo deployment stray-deploy --to-revision=1 && kubectl rollout pause deployment stray-deploy
- kubectl rollout resume deployment stray-deploy
- kubectl rollout history deployment stray-deploy
- kubectl get rs -o wide
- kubectl get pods -o wide -n kube-system
- kubectl get svc -n kube-system -o wide
- kubectl create configmap nginx-config --from-literal=nginx_port=80 --from-literal=server_name=quay.io
- kubectl edit configmap nginx-config
- kubectl create secret generic mysql-root-password --from-literal=password=generic
- kubectl describe secret mysql-root-password
- kubectl get secret mysql-root-password -o yaml base64解码即可
echo Z2VuZXJpYw== | base64 --decode - kubectl proxy --port=8080
- curl localhost:8080/api/v1/namespaces 核心群组
- curl localhost:8080/apis/apps/v1/namespaces/kube-system/deployments
- kubectl get serviceaccount --all-namespaces
- kubectl create serviceaccount sa-demo -o yaml --dry-run=client
- kubectl get pod brute-statefulset-0 -o yaml --export
- kubectl config view
- kubectl config set-credentials exploit-demo --client-certificate=exploit.crt --client-key=exploit.key [--embed-certs=true]
- kubectl config view
- kubectl config set-context exploit-demo@kubernetes --cluster=kubernetes --user=exploit-demo
kubectl config view - kubectl config current-context
- kubectl config use-context exploit-demo@kubernetes
- kubectl config set-cluster cluster-demo --kubeconfig=/tmp/kube.conf --server="https://pend1:6443" --certificate-authority=/etc/kubernetes/pki/ca.crt
- kubectl config view --kubeconfig=/tmp/kube.conf