alibaba/kt-connect

ktctl必须在.kube/config中必须存在一个config文件么

wzjaa opened this issue · 1 comments

wzjaa commented

Describe the bug
现在存在两个环境,使用-c指定config的文件地址,使用 ktctl -c e:\k8sconfig\config -d -n devops connect启动kt,如果.kube/config文件不存在,项目启动回报错,kt可以正常启动

Log
kt启动日志
PS C:\Users\PC> ktctl -c e:\k8sconfig\config -n devops connect --dnsMode hosts:devops,redis 5:56PM INF Using cluster context kubernetes-admin@kubernetes (kubernetes) 5:56PM INF KtConnect 0.3.7 start at 30764 (windows 386) 5:56PM INF Fetching cluster time ... 5:56PM INF Using tun2socks mode 5:56PM INF Successful create config map kt-connect-shadow-gmveb 5:56PM INF Deploying shadow pod kt-connect-shadow-gmveb in namespace devops 5:56PM INF Waiting for pod kt-connect-shadow-gmveb ... 5:56PM INF Pod kt-connect-shadow-gmveb is ready 5:56PM INF Port forward local:25773 -> pod kt-connect-shadow-gmveb:22 established 5:56PM INF Socks proxy established 2023/04/20 17:56:26 Using existing driver 0.14 2023/04/20 17:56:26 Creating adapter 2023/04/20 17:56:27 Spawning native process to remove instance 5:56PM INF Tun device KtConnectTunnel is ready 2023/04/20 17:56:28 Removed orphaned adapter "KtConnectTunnel 1" 5:56PM INF Adding route to 10.97.0.0/16 5:56PM INF Adding route to 10.109.0.0/16 5:56PM INF Adding route to 10.102.0.0/16 5:56PM INF Adding route to 10.104.0.0/16 5:56PM INF Adding route to 10.105.0.0/16 5:56PM INF Adding route to 10.106.0.0/16 5:56PM INF Adding route to 10.96.0.0/24 5:56PM INF Adding route to 10.103.0.0/16 5:56PM INF Adding route to 10.98.0.0/16 5:56PM INF Adding route to 10.99.0.0/16 5:56PM INF Adding route to 10.107.0.0/16 5:56PM INF Adding route to 10.111.0.0/16 5:56PM INF Adding route to 10.101.0.0/16 5:56PM INF Adding route to 10.110.0.0/16 5:56PM INF Adding route to 10.108.167.53/32 5:56PM INF Adding route to 10.244.0.0/16 5:56PM INF Adding route to 10.50.3.0/25 5:56PM INF Adding route to 10.50.3.128/26 5:56PM INF Adding route to 10.50.3.224/27 5:56PM INF Adding route to 10.50.3.208/28 5:56PM INF Adding route to 10.50.3.200/29 5:56PM INF Adding route to 10.50.3.192/30 5:56PM INF Adding route to 10.50.3.196/31 5:56PM INF Adding route to 10.50.3.198/32 5:56PM INF Route to tun device completed 5:56PM INF Setting up dns in hosts mode 5:56PM INF --------------------------------------------------------------- 5:56PM INF All looks good, now you can access to resources in the kubernetes cluster 5:56PM INF ---------------------------------------------------------------
项目启动日志
`2023-04-20 17:43:11.902 WARN [main] io.fabric8.kubernetes.client.Config - Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring.
2023-04-20 17:43:12.344 INFO [main] o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$d84ff5cb] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2023-04-20 17:43:12.419 WARN [main] io.fabric8.kubernetes.client.Config - Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring.
2023-04-20 17:43:12.420 WARN [main] io.fabric8.kubernetes.client.Config - Error reading service account token from: [/var/run/secrets/kubernetes.io/serviceaccount/token]. Ignoring.

. ____ _ __ _ _
/\ / ' __ _ () __ __ _ \ \ \
( ( )_
_ | '_ | '| | ' / ` | \ \ \
\/ )| |)| | | | | || (| | ) ) ) )
' |
| .__|| ||| |_, | / / / /
=========|
|==============|/=////
:: Spring Boot :: (v2.1.6.RELEASE)

2023-04-20 17:43:14.754 WARN [main] o.s.c.kubernetes.config.ConfigMapPropertySource - Can't read configMap with name: [devopsconfig] in namespace:[devops]. Ignoring
`

Environment (please complete the following information):

  • OS: windows11
  • Kubernetes Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.14", GitCommit:"3321ffc07d2f046afdf613796f9032f4460de093", GitTreeState:"clean", BuildDate:"2022-11-09T13:40:19Z", GoVersion:"go1.17.13", Compiler:"gc", Platform:"linux/amd64"}
  • KT Version:0.3.6

默认为用户主目录下的.kube/config文件中配置的集群。可通过KUBECONFIG环境变量或--kubeconfig运行参数指定使用其他配置文件路径。