attach Attach 到一个运行中的 container #(连接到这个容器:远程连接) exec 在一个 container 中执行一个命令 #(进入容器) port-forward Forward one or more local ports to a pod #(负责端口转发) proxy 运行一个 proxy 到 Kubernetes API server #(做代理) cp 复制 files 和 directories 到 containers 和...
logs 输出容器在 pod 中的日志 attach Attach 到一个运行中的 container exec 在一个 container 中执行一个命令 port-forward Forward one or more local ports to a pod proxy 运行一个 proxy 到 Kubernetes API server cp 复制 files 和 directories 到 containers 和从容器中复制 files 和 directories. auth ...
kubectl describe 显示一个或多个资源对象的详细信息 kubectl logs 输出pod资源对象中一个容器的日志 kubectl attach 连接到一个运行的容器 kubectl exec 在指定容器内执行命令 kubectl port-forward 将本机指定端口映射到pod资源对象的端口 kubectl proxy 将本机指定端口映射到kube-apiserver kubectl cp 用于pod与主机交...
kubectl cp /tmp/foo <podname>:/tmp/bar -c <containername> 将/tmp/foo本地文件复制到远程Pod中特定容器的/tmp/bar下。 auth* 检查授权。 attach* attach命令效果类似于logs -f,退出查看使用ctrl-c。如果一个Pod中有多个容器,要查看具体的某个容器的输出,需要在Pod名后使用-c containername指定运行的容器...
kubectl port-forward POD [LOCAL_PORT:]REMOTE_PORT [...[LOCAL_PORT_N:]REMOTE_PORT_N] # 将某个Pod的端口转发到本地 Example: kubectl port-forward nginx 8080:80 # 将名字为nginx的Pod的80端口转发到本地的8080端口 kubectl attach POD -c CONTAINER # 连接到现有的某个Pod(将某个Pod的标准输入输出...
$ kubectl logs -f my-pod -c my-container# 交互式 shell 的方式运行 pod$ kubectl run -i --tty busybox --image=busybox -- sh # 连接到运行中的容器$ kubectl attach my-pod -i # 转发 pod 中的 6000 端口到本地的 5000 端口$ kubectl port-forward my-pod 5000:6000 # 在已存在的容器中...
显示pod节点的标签信息 $ kubectl get pod --show-labels 根据指定标签匹配到具体的pod $ kubectl get pods -l app=example 查看node节点列表 $ kubectl get node 显示node节点的标签信息 $ kubectl get node --show-labels 查看pod详细信息,也就是可以查看pod具体运行在哪个节点上(ip地址信息) ...
logs 输出容器在 pod 中的日志 attach Attach 到一个运行中的 container exec 在一个 container 中执行一个命令 port-forwardForwardone or more local ports to a pod proxy 运行一个 proxy 到KubernetesAPIserver cp 复制 files 和 directories 到 containers 和从容器中复制 files 和 directories.authInspectauthor...
$ kubectl attach my-pod -i # 连接到运行中的容器 $ kubectl port-forward my-pod 5000:6000 # 转发 pod 中的 6000 端口到本地的 5000 端口 $ kubectl exec my-pod -- ls / # 在已存在的容器中执行命令(只有一个容器的情况下) $ kubectl exec my-pod -c my-container -- ls / # 在已存...
kubectl attach (POD | TYPE/NAME) -c CONTAINER 示例: # 连接到指定pod中正在运行的第一个容器 kubectl attach <podname> # 连接到指定pod中正在运行容器名为 myhello的容器 kubectl attach <podname> -c myhello # 连接到指定deployments正在运行的第一个容器 kubectl attach deployments/myapp-deployment 四、...