官方参考来源
下载地址
参考教程
安装
复制在文件夹,在windows 环境变量中添加路径
测试
kubectl version --client
kubectl cluster-info
创建一个HTTP 服务器
kubectl create deployment hello-minikube --image=k8s.gcr.io/echoserver:1.10
kubectl expose deployment hello-minikube --type=NodePort --port=8080
hello-minikube Pod 开始运行,但是必须等到 Pod 启动 ,测试Pod是否运行
kubectl get pod
以下两个状态一个创建过程中,一个已经成功运行
可以通过以下命令得到暴露的服务, 把获取的url 粘贴到浏览器能看到本地集群的细节
minikube service hello-minikube --url
删除服务
kubectl delete services hello-minikube
kubectl delete deployment hello-minikube
开启第二个终端窗口去运行代理,代理可以通过CTRL+C的方式终止
kubectl proxy
使用 kubectl 进行故障排除
kubectl get - 列出资源
kubectl describe - 显示有关资源的详细信息
kubectl logs - 打印 pod 和其中容器的日志
kubectl exec - 在 pod 中的容器上执行命令
kubectl get nodes 查看node节点信息
kubectl describe node k8s-node-01 查看某个node的详细信息
删除的方法
1、先删除pod
2、再删除对应的deployment
kubectl get pod -n hello-minikube
kubectl delete pod jello-minikube-dsf44735dhd -n hello-minikube
kubectl get pod -n hello-minikube
kubectl get deployment -n hello-minikube
kubectl delete deployment hello-minikube-n hello-minikube
kubectl get deployment -n hello-minikube
kubectl get pod -n hello-minikube
另外一种安装方法
choco install kubernetes-cli