kubernetes - 如何将 shell 连接到 Kubernetes pod
问题描述
我使用 kubectl 创建了一个 pod。
我想连接到这个 pod 的端点。如何使用 kubectl 做到这一点?
解决方案
您可以进行端口转发以从本地系统访问 pod
kubectl port-forward pods/redis-master-765d459796-258hz 7000:6379
https://kubernetes.io/docs/tasks/access-application-cluster/port-forward-access-application-cluster/
或者你可以在正在运行的容器中获取一个 shell
kubectl exec -it pods/shell-demo -- /bin/bash
https://kubernetes.io/docs/tasks/debug-application-cluster/get-shell-running-container/
推荐阅读
- command - PHP Composer,命令行(CLI)添加类路径以在composer.json中自动加载PSR-4/PSR-0/文件
- javascript - 如何返回 ap 元素的行数?
- c# - Autofac 程序集扫描 - .NET Core
- c# - C# 清除按钮将我的所有 int 设置为 0,将字符串设置为“”
- xspec - 在 Ant 中使用内联 CSS 获取 Xspec 测试结果
- kendo-ui-angular2 - 在输入特定数量的字符后限制自动完成绑定
- c# - emgu 或 opencv 基于图像中某些颜色的对象检测的最快方法
- c# - 1)领域事件和事务一致性与2)集成事件和最终一致性之间的关系是什么
- java - 如何使用android studio在Firebase中存储用户分数以及如何访问firebase中的子节点
- java - 两个列表JAVA的交点