1.安装wsL
https://wslstorestorage.blob.core.windows.net/wslblob/wsl_update_x64.msi
2.配置kubectl和kt-connect
下载 kuberctl
https://storage.googleapis.com/kubernetes-release/release/v1.25.0/bin/windows/amd64/kubectl.exe
下载 kt-connect
https://alibaba.github.io/kt-connect/#/zh-cn/guide/downloads
添加相关环境变量
1.将kt-connect 下载的文件鹤kubectl下载的exe文件放到D:\soft\k8s(按照个人兴趣) 目录下
2.在系统变量中添加KUBECTL=D:\soft\k8s
3.在path环境变量中添加%KUBECTL%
添加相关k8s 相关kubeconfig到本地环境
路径 C:\Users\用户名\.kube\config
注意(config无后缀名)
启动
https://alibaba.github.io/kt-connect/#/zh-cn/cli/connect
异常
Error from server (Forbidden): services is forbidden: User "XXX" cannot list resource "services" in API group "" i the namespace "kube-system"
需要让k8s管理员开放XXX账号权限
异常
Unable to connect to the server: dial tcp [::1]:8080: connectex: No connection could be made because the target machine
actively refused it.
kubeconfig存在问题,需要关注相关信息是否正确
异常
启动
--excludeIps 排除掉rancher相关ip
--namespace 设置命名空间
-d debug模式
ktctl connect --excludeIps 192.168.12.xxx --namespace yx-test -d
单元测试 @Test ( spring-cloud-starter-kubernetes)
1.@EnableEurekaClient修改成 @EnableDiscoveryClient
2.添加配置配置namespace
ribbon:
KubernetesNamespace: yx-test