kubectl的语法为:kubectl [command] [TYPE] [NAME] [flags],其中 command、TYPE、NAME 和 flags 分别是: command:指定要对一个或多个资源执行的操作,例如 create、get、describe、delete。 TYPE:指定资源类型。资源类型不区分大小写, 可以指定单数、复数或缩写形式。例如,以下命令输出相同的结果: kubectl get pod ...
kubectlgetpod-n<namespace><pod name>-o jsonpath='{"###InitContainerStatus\n"}{range .status.initContainerStatuses[*]}{.name}{":\t READY: "}{.ready}{"\n"}{end}{"###ContainerStatus\n"}{range .status.containerStatuses[*]}{.name}{":\t READY: "}{.ready}{"\t STARTED: "}{.star...
kubectl查看pod的namespace kubectl 查看configmap,1.ConfigMapConfigMap是一种 API 对象,用来将非机密性的数据保存到键值对中。使用时,Pods可以将其用作环境变量、命令行参数或者存储卷中的配置文件。ConfigMap的主要作用就是为了让镜像和配置文件解耦,以便
kubectl logs -n [namespace] [pod-name] kubectl logs -n [namespace] /deployment/[deployment-name] # Use -f flag for continuous streaming # Run a command inside an existing container kubectl exec -it -n [namespace] [pod-name] -- [command...] 使用节点 节点是提供计算能力和存储的基础实...
Helpful commands for debugging # Run busybox container k run busybox --image=busybox:1.28 --rm --restart=Never -it sh # Connect to a specific container in a Pod k exec -it busybox -c busybox2 -- /bin/sh # adding limits and requests in command kubectl run nginx --image=nginx -...
Command(命令):指你想要执行的操作(创建、删除等等) Type(类别):指你正在执行命令的资源类型(Pod、Service等) Name(名称):对象的名称(需区分大小写)。如果未指定名称,则可以获取有关命令匹配的所有资源的信息(例如Pod) Flags(标志):这个可以按需选择(非必须),不过它在查找特定资源时非常有用。例如,--namespace...
NAMESPACE:事件发生的命名空间。 LAST SEEN:事件最后一次出现的时间。 TYPE:类型:事件类型(如 Normal 或 Warning)。 REASON:事件发生的原因。 OBJECT:与事件相关的 Kubernetes 资源(如 pod、节点)。 MESSAGE:与事件相关的描述或消息。 排除pod 初始化故障 ...
Replace kubectl with k and execute kubectl command without specifying namespace. Autocompletion If--contextflag should be set, runk c <context> Command hint Interpolated command hint is printed through stderr, not stdout: k get pod -l istio=pilot -o jsonpath='{.items[0].metadata.name}'--...
Use when command != logout. Set the namespace for the kubectl command by using the –namespace flag. If the namespace is not provided, the commands will run in the default namespace.command - Command string. Allowed values: apply, create, delete, exec, expose, get, login, logout, ...
[centos@ml-k8s-1 test1]$ kubectl debug -it pod1 --image=busybox:1.28 --target=pod1Defaulting debug container name to debugger-h59bb.If you don't see a command prompt, try pressing enter./ # lsbin dev etc home proc root sys tmp usr var(unreachable)/data # ...