Kubernets
官网有各系统的安装教程:https://kubernetes.io/zh/docs/tasks/tools/
Windows
下安装kubectl
下载kubectl.exe
,链接中的v1.18.5可以修改为其他版本
https://storage.googleapis.com/kubernetes-release/release/v1.18.5/bin/windows/amd64/kubectl.exe
配置PATH
检查安装
D:\software\dev\k8s>kubectl version Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.5", GitCommit:"e6503f8d8f769ace2f338794c914a96fc335df0f", GitTreeState:"clean", BuildDate:"2020-06-26T03:47:41Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"windows/amd64"} Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine actively refused it.
cmd
新建.kube
文件夹
在C:\Users\Administrator
或者其他用户C:\Users\80022319
下使用命令行新建.kube
文件夹,windows
不允许邮件新建以.
开头的文件夹,只能用命令行新建
md .kube
在.kube
下新建连接k8s
集群的配置文件config
配置文件的内容,可以直接从你们的服务器上copy,例如某服务器可以连接k8s集群,这台服务器一定安装了kubectl
,通过cd ~ && ls -a | grep .kube
查看是否有这个文件夹,然后拷贝config
文件。或者让你们的运维帮你搞一下配置
验证连接k8s
集群
D:\software\dev\k8s>kubectl version Client Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.5", GitCommit:"e6503f8d8f769ace2f338794c914a96fc335df0f", GitTreeState:"clean", BuildDate:"2020-06-26T03:47:41Z", GoVersion:"go1.13.9", Compiler:"gc", Platform:"windows/amd64"} Server Version: version.Info{Major:"1", Minor:"16", GitVersion:"v1.16.2", GitCommit:"c97fe5036ef3df2967d086711e6c0c405941e14b", GitTreeState:"clean", BuildDate:"2019-10-15T19:09:08Z", GoVersion:"go1.12.10", Compiler:"gc", Platform:"linux/amd64"}