kubectl exec
The kubectl exec command is used to execute a command inside a running container in a Kubernetes pod.
The syntax for the command is as follows:
kubectl exec [OPTIONS] POD_NAME COMMAND [ARG...]
where:
POD_NAMEis the name of the pod where the container is running.COMMANDis the command to be executed inside the container.[ARG...]are optional arguments to the command.
Some common options for kubectl exec are:
-ispecifies that the command should be executed interactively, allowing you to input data.-tattaches a terminal to the container, allowing you to interact with it.-cspecifies the name of the container to execute the command in, if the pod has more than one container.
Example usage:
kubectl exec -it my-pod -- /bin/bash
This command will open a bash shell inside the container running in the my-pod pod
原文地址: https://www.cveoy.top/t/topic/dnBF 著作权归作者所有。请勿转载和采集!