kubectl 版本和集群版本之间的差异必须在一个小版本号内。 例如:v1.23 版本的客户端能与 v1.22、 v1.23 和 v1.24 版本的控制面通信。 用最新兼容版的 kubectl 有助于避免不可预见的问题。
https://kubernetes.io/zh/docs/home/
curl -LO https://dl.k8s.io/release/v1.23.0/bin/linux/amd64/kubectl
curl -LO "https://dl.k8s.io/v1.23.0/bin/linux/amd64/kubectl.sha256" echo "$(<kubectl.sha256) kubectl" | sha256sum --check
说明:
1. 验证通过时,输出为:kubectl: OK
2. 验证失败时,sha256 将以非零值退出,并打印如下输出:
```
kubectl: FAILED
sha256sum: WARNING: 1 computed checksum did NOT match
```
3. 下载的 kubectl 与校验和文件版本必须相同。
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
kubectl version --client
curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun sudo systemctl start docker sudo yum install -y yum-utils device-mapper-persistent-data lvm2 sudo yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo sudo systemctl daemon-reload sudo systemctl restart docker sudo systemctl enable docker
curl -LO https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64 sudo install minikube-linux-amd64 /usr/local/bin/minikube
useradd chiyi passwd chiyi -> chiyi@123 sudo usermod -aG docker chiyi newgrp docker su chiyi
minikube start --image-mirror-country='cn'
kubectl cluster-info kubectl cluster-info dump
minikube kubectl -- get pods
kubectl get po -A
minikube dashboard
kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.4 kubectl expose deployment hello-minikube --type=NodePort --port=8081 kubectl get services hello-minikube minikube service hello-minikube kubectl port-forward service/hello-minikube 2001:8081
kubectl get namespaces kubectl get nodes kubectl get pods kubectl get deployments kubectl get services