1、直接映射pod内端口,类似于nodeport 但是只是临时访问,可用于调试查看
kubectl port-forward pod名称 宿主机端口:pod内端口 -n 命名空间 --address 请求地址ip
pod 名称也可以换成service服务例如
kubectl port-forward svc/service名称 宿主机端口:pod内端口 -n 命名空间 --address 请求地址ip
2、pod 内文件到宿主机
kubectl cp -n 命名空间 pod名字:/data/1.hprof(在pod中要下载文件的路径) /Users/Desktop/hprof/1.hprof(本地保存文件的路径)
3、pod 内安装工具
引用自 http://t.csdnimg.cn/fMLJZ
安装 telnet命令 net-tools工具包
apt-get update && apt-get install net-tools -y
安装 ps命令 procps工具包
apt-get update && apt-get install procps -y
安装curl
apt-get update && apt-get install curl -y
安装ping
apt-get install inetutils-ping -y