############PS##################### JHC142: C:\ [ base 3.12.4]❯ kubectl version --client Client Version: v1.29.2 Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
3、配置K8S集群的config
将k8s集群的config配置文件拷贝到C:\Users\xxxx\.kube 文件夹中
4、验证是否能连接到k8s集群
1 2 3 4 5 6 7 8
kubectl cluster-info
############PS##################### JHC142: C:\ [ base 3.12.4] ❯ kubectl cluster-info Kubernetes control plane is running at https://172.x.x.x:6443 CoreDNS is running at https://172.16.2.129:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
5、下载ktconnect并配置
下载 kt connect 并将其放到和kubectl client 的同一个 bin目录下
6、验证是否安装成功
1 2 3 4 5
ktctl -v
############PS##################### JHC142: C:\ [ base 3.12.4] ❯ ktctl -v ktctl version 0.3.7
############PS##################### JHC142: C:\ [ base 3.12.4] ❯ ktctl connect -n bluewhale-platform --excludeIps 172.16.2.0/24 4:15PM INF Using cluster context kubernetes-admin@kubernetes (kubernetes) 4:15PM INF KtConnect 0.3.7 start at 22548 (windows amd64) 4:15PM INF Fetching cluster time ... 4:15PM INF Using tun2socks mode 4:15PM INF Successful create config map kt-connect-shadow-odtnt 4:15PM INF Deploying shadow pod kt-connect-shadow-odtnt in namespace bluewhale-platform 4:15PM INF Waiting for pod kt-connect-shadow-odtnt ... 4:15PM INF Pod kt-connect-shadow-odtnt is ready 4:15PM INF Port forward local:10441 -> pod kt-connect-shadow-odtnt:22 established 4:15PM INF Socks proxy established 2024/08/23 16:15:17 Using existing driver 0.14 2024/08/23 16:15:17 Creating adapter 4:15PM INF Tun device KtConnectTunnel is ready 2024/08/23 16:15:17 Removed orphaned adapter "KtConnectTunnel 1" 4:15PM INF Adding route to 10.96.0.0/16 4:15PM INF Adding route to 100.90.254.0/24 4:15PM INF Adding route to 100.82.112.0/24 4:15PM INF Adding route to 100.85.170.0/24 4:15PM INF Adding route to 100.103.44.0/24 4:15PM INF Route to tun device completed 4:15PM INF Setting up dns inlocal mode 4:15PM INF Port forward local:45198 -> pod kt-connect-shadow-odtnt:53 established 4:15PM INF Setup local DNS with upstream [tcp:127.0.0.1:45198 udp:172.16.1.117:53] 4:15PM INF Creating udp dns on port 53 4:15PM INF --------------------------------------------------------------- 4:15PM INF All looks good, now you can access to resources in the kubernetes cluster 4:15PM INF ---------------------------------------------------------------