1、安裝kubectl
step1:下載
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubect
或下載指定版本
curl -LO https://dl.k8s.io/release/v1.26.0/bin/linux/amd64/kubectl
step2:安裝
install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
step3:驗證
# kubectl version --client
或
kubectl version --client --output=yaml
2、kubectl連接kubernets
kubectl get pods -n demo-test --kubeconfig=./config
3、kubectl安裝應用
kubectl get nodes --kubeconfig=./config -n demo-test
kubectl taint nodes k8s-node-3 sonarqube=true:NoSchedule --kubeconfig=./config -n demo-test
4、指定yaml文件安裝
kubectl apply -f cacerts.yaml