赞
踩
首先类似于Docker容器,Kubernetes 使用kubectl 进行命令行操作
docker exec -ti your-container-name /bin/sh
kubectl exec -ti your-pod-name -n your-namespace – /bin/sh
kubectl exec - Execute a command against a container in a pod.
// Get output from running 'date' from pod <pod-name>. By default, output is from the first container.
$ kubectl exec <pod-name> date
// Get output from running 'date' in container <container-name> of pod <pod-name>.
$ kubectl exec <pod-name> -c <container-name> date
// Get an interactive TTY and run /bin/bash from pod <pod-name>. By default, output is from the first container.
$ kubectl exec -ti <pod-name> /bin/bash
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。