(标准输出) kubectl logs my-pod -c my-container # 获取 Pod 容器的日志(标准输出, 多容器场景) kubectl logs -l name=myLabel -c my-container # 获取含 name=myLabel 标签的 Pod 容器日志(标准输出, 多容器场景) kubectl logs my-pod -c my-container --previous # 获取 Pod 中某容器的上个实例...
logs 输出容器在 pod 中的日志 #(作用于排障) attach Attach 到一个运行中的 container #(连接到这个容器:远程连接) exec 在一个 container 中执行一个命令 #(进入容器) port-forward Forward one or more local ports to a pod #(负责端口转发) proxy 运行一个 proxy 到 Kubernetes API server #(做代理)...
在pod里执行命令 kubectl exec <pod-name> -c 指定容器 不指定为第一个容器 -- 后面执行命令 [root@node01 ~]# kubectl exec nginx -n dev -- date Wed Nov 2 18:30:54 UTC 2022 [root@node01 ~]# kubectl exec nginx -n dev -c nginx -- date Wed Nov 2 18:31:35 UTC 2022 进入容器 与...
autoscale create exec logs rollout version[root@k8s-master~]# kubectl e edit exec explain expose[root@k8s-master~]# kubectl exec---add-dir-header--kubeconfig=--request-timeout--alsologtostderr--log-backtrace-at--request-timeout=--as--log-backtrace-at=-s--as=--log-dir--server--as-...
1[root@Master1 ~]# kubectl get nodes 2NAME STATUS AGE 3node1 Ready 2d 4node2 Ready 2d 1. 2. 3. 4. 查看所有的pods(详细) 1[root@Master1 ~]# kubectl get pods -o wide 2NAME READY STATUS RESTARTS AGE IP NODE 3pod-redis 1/1 Running 1 4h 10.0.78.2 node1 ...
// Connect returns a handler for the pod exec proxyfunc (r *ExecREST) Connect(ctx context.Context, name string, opts runtime.Object, responder rest.Responder) (http.Handler, error) {execOpts,ok:=opts.(*api.PodExecOptions)if!ok{returnnil,fmt.Errorf("invalid options object: %#v",opts)...
as schedulabledrain Drain node in preparation for maintenancetaint Update the taints on one or more nodesTroubleshooting and Debugging Commands:describe Show details of a specific resource or group of resourceslogs Print the logs for a container in a podattach Attach to a running containerexec Execut...
这可能有多种原因,首先让我们检查pod是否真的创建了。就像ehmad11建议使用kubectl get pods --all-...
[root@node-1~]# docker tag docker.io/tianyebj/pod-infrastructure registry.access.redhat.com/rhel7/pod-infrastructure:latest # 这里首先会去检查本地目录镜像名称,如果没有会去拉去这个镜像,所以在本地把下载好的镜像指向这个名称 [root@node-1~]# cat /etc/kubernetes/kubelet |grep"KUBELET_POD_INFRA_...
[root@ku8-1 tmp]# 1 2 3 4 5 6 7 更为常用的方式则是登陆到pod中,在有条件的时候,进行故障发生时的现场确认,这种方式是最为直接有效和快速,但是对权限要求也较多。 [root@ku8-1 tmp]# kubectl exec -it mysql-478535978-1dnm2 sh#hostnamemysql-478535978-1dnm2# ...