KUBERNETES(1)(kubernetes)
π KUBERNETES(1)(kubernetes) π
okay bestie, so this is a page from the kubernetes manual set. written by Eric Paris, Jan 2015. it's giving legacy. it's giving β¨historyβ¨. let's get into it π«Ά
πΈ NAME πΈ
kubectl alpha debug β create debugging sessions for troubleshooting workloads and nodes π
β¨ SYNOPSIS β¨
kubectl alpha debug [OPTIONS]
π¦ DESCRIPTION π¦
NOTE:kubectl alpha debugis deprecated and will be removed in release 1.21. Please usekubectl debuginstead. π like... it's over bestie. move on. she's retiring.
Debug cluster resources using interactive debugging containers π§β¨
debug provides automation for common debugging tasks for cluster objects identified by resource and name. Pods will be used by default if no resource is specified. no resource? no problem, we default to pods, periodt π
The action taken by debug varies depending on what resource is specified. Supported actions include:
- Workload: create a copy of an existing pod with certain attributes changed, for example changing the image tag to a new version π
- Workload: add an ephemeral container to an already running pod, for example to add debugging utilities without restarting the pod π«Ά
- Node: create a new pod that runs in the node's host namespaces and can access the node's filesystem π
π OPTIONS π
--arguments-only=falseβ if specified, everything after--will be passed to the new container asArgsinstead ofCommand. yes, everything. she takes it all π--attach=falseβ if true, wait for the container to start running, and then attach as ifkubectl attach ...were called. defaultfalse, unless-i/--stdinis set, in which case the default istrueπ-c,--container=""β container name to use for debug container π--copy-to=""β create a copy of the target Pod with this name β¨--env=[]β environment variables to set in the container π±--image=""β container image to use for debug container πΌοΈ--image-pull-policy=""β the image pull policy for the container. if left empty, this value will not be specified by the client and defaulted by the server. so like, the server decides. not us. we stay out of it π--quiet=falseβ if true, suppress informational messages π€«--replace=falseβ when used with--copy-to, delete the original Pod. bestie... it's gone. lowkey dramatic π--same-node=falseβ when used with--copy-to, schedule the copy of target Pod on the same node π--set-image=[]β when used with--copy-to, a list ofname=imagepairs for changing container images, similar to howkubectl set imageworks π¨--share-processes=trueβ when used with--copy-to, enable process namespace sharing in the copy π€-i,--stdin=falseβ keep stdin open on the container(s) in the pod, even if nothing is attached π--target=""β when using an ephemeral container, target processes in this container name π―-t,--tty=falseβ allocate a TTY for the debugging container π»
π OPTIONS INHERITED FROM PARENT COMMANDS π
these came from the parent command, she inherited the whole wardrobe π
--add-dir-header=falseβ if true, adds the file directory to the header of the log messages π--alsologtostderr=falseβ log to standard error as well as files π--application-metrics-count-limit=100β max number of application metrics to store (per container) π’--as=""β username to impersonate for the operation π--as-group=[]β group to impersonate for the operation, this flag can be repeated to specify multiple groups π--azure-container-registry-config=""β path to the file containing Azure container registry configuration information βοΈ--boot-id-file="/proc/sys/kernel/random/boot_id"β comma-separated list of files to check for boot-id. use the first one that exists π₯--cache-dir="/home/user/.kube/cache"β default cache directory ποΈ--certificate-authority=""β path to a cert file for the certificate authority π--client-certificate=""β path to a client certificate file for TLS π--client-key=""β path to a client key file for TLS π--cloud-provider-gce-l7lb-src-cidrs=130.211.0.0/22,35.191.0.0/16β CIDRs opened in GCE firewall for L7 LB traffic proxy health checks π--cloud-provider-gce-lb-src-cidrs=130.211.0.0/22,209.85.152.0/22,209.85.204.0/22,35.191.0.0/16β CIDRs opened in GCE firewall for L4 LB traffic proxy health checks π--cluster=""β the name of the kubeconfig cluster to use ποΈ--container-hints="/etc/cadvisor/container_hints.json"β location of the container hints file πΊοΈ--containerd="/run/containerd/containerd.sock"β containerd endpoint π--containerd-namespace="k8s.io"β containerd namespace π·οΈ--context=""β the name of the kubeconfig context to use πͺ--default-not-ready-toleration-seconds=300β indicates thetolerationSecondsof the toleration fornotReady:NoExecutethat is added by default to every pod that does not already have such a toleration β±οΈ--default-unreachable-toleration-seconds=300β indicates thetolerationSecondsof the toleration forunreachable:NoExecutethat is added by default to every pod that does not already have such a toleration β±οΈ--disable-root-cgroup-stats=falseβ disable collecting root Cgroup stats π«--docker="unix:///var/run/docker.sock"β docker endpoint π³--docker-env-metadata-whitelist=""β a comma-separated list of environment variable keys matched with specified prefix that needs to be collected for docker containers π--docker-only=falseβ only report docker containers in addition to root stats π--docker-root="/var/lib/docker"β DEPRECATED: docker root is read from docker info (this is a fallback, default:/var/lib/docker) π--docker-tls=falseβ use TLS to connect to docker π--docker-tls-ca="ca.pem"β path to trusted CA β--docker-tls-cert="cert.pem"β path to client certificate π--docker-tls-key="key.pem"β path to private key π--enable-load-reader=falseβ whether to enable cpu load reader π--event-storage-age-limit="default=0"β max length of time for which to store events (per type). value is a comma separated list of key values, where the keys are event types (e.g.:creation,oom) or"default"and the value is a duration. default is applied to all non-specified event types β³--event-storage-event-limit="default=0"β max number of events to store (per type). value is a comma separated list of key values, where the keys are event types (e.g.:creation,oom) or"default"and the value is an integer. default is applied to all non-specified event types π’--global-housekeeping-interval=1m0sβ interval between global housekeepings π§Ή--housekeeping-interval=10sβ interval between container housekeepings π§Ό--insecure-skip-tls-verify=falseβ if true, the server's certificate will not be checked for validity. this will make your HTTPS connections insecure π bestie don't--kubeconfig=""β path to the kubeconfig file to use for CLI requests ποΈ--log-backtrace-at=:0β when logging hits linefile:N, emit a stack trace πͺ--log-cadvisor-usage=falseβ whether to log the usage of the cAdvisor container π--log-dir=""β if non-empty, write log files in this directory π--log-file=""β if non-empty, use this log file π--log-file-max-size=1800β defines the maximum size a log file can grow to. unit is megabytes. if the value is0, the maximum file size is unlimited π--log-flush-frequency=5sβ maximum number of seconds between log flushes π½--logtostderr=trueβ log to standard error instead of files π’--machine-id-file="/etc/machine-id,/var/lib/dbus/machine-id"β comma-separated list of files to check for machine-id. use the first one that exists π₯--match-server-version=falseβ require server version to match client version π€-n,--namespace=""β if present, the namespace scope for this CLI request π·οΈ--one-output=falseβ if true, only write logs to their native severity level (vs also writing to each lower severity level π--password=""β password for basic authentication to the API server π--profile="none"β name of profile to capture. one of (none|cpu|heap|goroutine|threadcreate|block|mutex) πΈ--profile-output="profile.pprof"β name of the file to write the profile to π--referenced-reset-interval=0β reset interval for referenced bytes (container_referenced_bytesmetric), number of measurement cycles after which referenced bytes are cleared, if set to0referenced bytes are never cleared (default:0) π--request-timeout="0"β the length of time to wait before giving up on a single server request. non-zero values should contain a corresponding time unit (e.g.1s,2m,3h). a value of zero means don't timeout requests. she waits forever, loyalty π-s,--server=""β the address and port of the Kubernetes API server π‘--skip-headers=falseβ if true, avoid header prefixes in the log messages π«--skip-log-headers=falseβ if true, avoid headers when opening log files π«--stderrthreshold=2β logs at or above this threshold go to stderr π’--storage-driver-buffer-duration=1m0sβ writes in the storage driver will be buffered for this duration, and committed to the non memory backends as a single transaction π¦--storage-driver-db="cadvisor"β database name ποΈ--storage-driver-host="localhost:8086"β database host:port π₯οΈ--storage-driver-password="root"β database password π--storage-driver-secure=falseβ use secure connection with database π--storage-driver-table="stats"β table name π--storage-driver-user="root"β database username π€--tls-server-name=""β server name to use for server certificate validation. if it is not provided, the hostname used to contact the server is used π·οΈ--token=""β bearer token for authentication to the API server ποΈ--update-machine-info-interval=5m0sβ interval between machine info updates π--user=""β the name of the kubeconfig user to use π€--username=""β username for basic authentication to the API server π€-v,--v=0β number for the log level verbosity π--version=falseβ print version information and quit π--vmodule=β comma-separated list ofpattern=Nsettings for file-filtered logging π§©--warnings-as-errors=falseβ treat warnings received from the server as errors and exit with a non-zero exit code β οΈ
okay that's part 1, bestie β don't go anywhere, there's more coming π«Άβ¨
β¨ EXAMPLE β¨
ok bestie, this is the part where it all clicks. real commands, real vibes, copy-paste away π
# Create an interactive debugging session in pod mypod and immediately attach to it.
# (requires the EphemeralContainers feature to be enabled in the cluster)
kubectl debug mypod -it --image=busybox
# Create a debug container named debugger using a custom automated debugging image.
# (requires the EphemeralContainers feature to be enabled in the cluster)
kubectl debug --image=myproj/debug-tools -c debugger mypod
# Create a copy of mypod adding a debug container and attach to it
kubectl debug mypod -it --image=busybox --copy-to=my-debugger
# Create a copy of mypod changing the command of mycontainer
kubectl debug mypod -it --copy-to=my-debugger --container=mycontainer -- sh
# Create a copy of mypod changing all container images to busybox
kubectl debug mypod --copy-to=my-debugger --set-image=*=busybox
# Create a copy of mypod adding a debug container and changing container images
kubectl debug mypod -it --copy-to=my-debugger --image=debian --set-image=app=app:debug,sidecar=sidecar:debug
# Create an interactive debugging session on a node and immediately attach to it.
# The container will run in the host namespaces and the host's filesystem will be mounted at /host
kubectl debug node/mynode -it --image=busybox
lowkey obsessed with how clean that is. six little recipes and suddenly you're the person everyone pings when a pod is acting up. π¦
heads up bestie: the first two recipes need theEphemeralContainersfeature enabled in the cluster, or they're just gonna sit there looking pretty. the node one mounts the host's filesystem at/hostand runs in the host namespaces β that's real power, so use it like a main character, not like a menace. π
π SEE ALSO
yeah it's just the one reference and yes it has a lil trailing comma, we don't ask questions, we simply respect the formatting. β¨
πΈ HISTORY πΈ
storytime. January 2015, originally compiled by Eric Paris (eparis at redhat dot com) based on the kubernetes source material, but hopefully they have been automatically generated since! π
and that's the whole page bestie, you ate it, no crumbs. π this lil manual comes from the Manuals collection, filed under User, and its identifier is KUBERNETES(1)(kubernetes) β iconic, periodt, go debug something gorgeous. π«Άβ¨π
π¦ where this page comes from
- debian bookworm: kubernetes-client 1.20.5+really1.20.2-1.1+deb12u1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms