``` USAGE: ktctl [global options] command [command options] [arguments...]
COMMANDS: connect 本地连接K8s集群环境。 mesh 转发K8s Deployment 请求到本地。 help, h Shows a list of commands or help for one command
GLOBAL OPTIONS: --namespace value, -n value 即测试环境所在K8s namespace,例如test2环境namespace为test2 --kubeconfig value, -c value K8s集群连接配置 (default: "${HOME}/.kube/config") --debug, -d debug mode --label value, -l value 代理Pod标签信息, 特性环境必须要带上virtual-env=特性环境标识。例如 --label=test2.proj1. --help, -h show help --version, -v print the version ```
------------命-令-分-割-线------------
连接test2环境
☆ ☆ ☆ ☆ ☆ sudo ktctl -d -n test2 connect
------------命-令-分-割-线------------
下面重点说明一下mesh --label virtual-env为本地环境标识,自定义即可,注意不要跟已有环境冲突,建议使用用自己的名字,如test2.yonghua mesh 后跟的是应用Deployment的name,即应用名。 --expose 暴露端口,支持多端口,形如 [port] 或者 [remote:local],即代理Pod和本地服务的port对。
sudo ktctl -d --label virtual-env=test2.abc --namespace test2 mesh springboot-virtualenv --expose 8080