KUBERNETES(1)(kubernetes)

πŸ“¦ version 1.20.2, in debian bookworm

πŸ’… 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 debug is deprecated and will be removed in release 1.21. Please use kubectl debug instead. πŸ’€ 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 as Args instead of Command. yes, everything. she takes it all 😌
  • --attach=false β€” if true, wait for the container to start running, and then attach as if kubectl attach ... were called. default false, unless -i/--stdin is set, in which case the default is true πŸ‘€
  • -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 of name=image pairs for changing container images, similar to how kubectl set image works 🎨
  • --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 the tolerationSeconds of the toleration for notReady:NoExecute that is added by default to every pod that does not already have such a toleration ⏱️
  • --default-unreachable-toleration-seconds=300 β€” indicates the tolerationSeconds of the toleration for unreachable:NoExecute that 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 line file: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 is 0, 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_bytes metric), number of measurement cycles after which referenced bytes are cleared, if set to 0 referenced 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 of pattern=N settings 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 the EphemeralContainers feature enabled in the cluster, or they're just gonna sit there looking pretty. the node one mounts the host's filesystem at /host and 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