navicat连接k8s里面的服务,例如MySQL
比如阿里云的kubernetes的namespace是test
的里部署了一个mysql-a你想在本地命令行操作。
1、查看mysql service和port
kubectl get svc -n test
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
mysql-a ClusterIP xxx.xx.xx.xx3306/TCP 1h
2、port-forward
kubectl port-forward service/mysql-a -n test 3307:3306
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
mysql-a ClusterIP xxx.xx.xx.xx3306/TCP 1h
3、登陆MySQ
mysql -h127.0.0.1 --port 3307 -uxxx -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
…………
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql>
本作品采用 知识共享署名-相同方式共享 4.0 国际许可协议 进行许可。
评论已关闭