kubectl exec
The kubectl command that runs a command, such as a shell, inside a running container.
In more detail
The API server passes it to the kubelet as the exec subresource of a pod. Opening a shell in a pod is high-value audit evidence and a common Falco alert.
Examples
kubectl exec web -- printenvIn the audit log, exec appears as a create request on the pods/exec subresource.Related terms
- kubectl — The command-line tool for talking to a Kubernetes cluster's API server: creating, reading, changing and deleting objects.
- kubelet — The agent on every Kubernetes node that starts and watches the node's containers and reports back to the API server.
- subresource — A Kubernetes API endpoint under an object, such as a pod's exec, log or status, with its own permissions.
- kubectl logs — The kubectl command that prints what a container wrote to its standard output and standard error.
- kubectl describe — The kubectl command that prints a readable summary of an object: its settings, current status and recent events.
- Kubernetes audit log — The Kubernetes API server's record of every request made to it: who asked, for what, and whether it was allowed.
- Pod — The smallest unit Kubernetes runs: one or more containers scheduled together on the same machine.
Taught in
- Running, And Still Down — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Persistent And Ephemeral Volumes — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Debugging Applications In Kubernetes — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Observability: Timed Drill And Checkpoint — Certified Kubernetes Application Developer (CKAD) Exam Prep
- ConfigMaps And Secrets — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Services And Empty Endpoints — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Services And Networking: Timed Drill And Checkpoint — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Mock Exam: Sixteen Tasks Against The Clock — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Final Review: Where Your Marks Are At Risk — Certified Kubernetes Application Developer (CKAD) Exam Prep
- Six Seconds, Every Secret — Certified Kubernetes Security Specialist (CKS) Exam Prep
- The Metadata Endpoint And The Kubelet's Front Door — Certified Kubernetes Security Specialist (CKS) Exam Prep
- Secrets In Use: Leaks Through Env, Specs And Images — Certified Kubernetes Security Specialist (CKS) Exam Prep
- Sandboxed Pods: RuntimeClass And gVisor — Certified Kubernetes Security Specialist (CKS) Exam Prep
- Encrypting Pod-to-Pod Traffic: mTLS With Istio And Cilium — Certified Kubernetes Security Specialist (CKS) Exam Prep
- Audit Policy: Choosing What The Cluster Remembers — Certified Kubernetes Security Specialist (CKS) Exam Prep
- Investigating An Attack: One Timeline, Two Logs — Certified Kubernetes Security Specialist (CKS) Exam Prep
- Immutable Containers: Read-Only At Runtime — Certified Kubernetes Security Specialist (CKS) Exam Prep
- Detection Review: Which Signal Catches It? — Certified Kubernetes Security Specialist (CKS) Exam Prep
- Final Review: The Cluster You Would Defend — Certified Kubernetes Security Specialist (CKS) Exam Prep
- Container Hardening: Distroless & Rootless — Cloud Security & DevSecOps Engineering
- Runtime Anomaly Detection with Falco & eBPF — Cloud Security & DevSecOps Engineering
- Securing the Kubernetes Control Plane & Node Components — Cloud Security & DevSecOps Engineering
- CloudTrail Logging, Integrity Validation & Athena — Cloud Security & DevSecOps Engineering
- A Name That Outlives Its Pods: Services And DNS — Kubernetes and Cloud Native Associate (KCNA) Exam Prep
- Not The Admin Certificate: RBAC And ServiceAccounts — Kubernetes and Cloud Native Associate (KCNA) Exam Prep
- Who May Call Payments: Pod Networking And Policy — Kubernetes and Cloud Native Associate (KCNA) Exam Prep
- Not As Root, Not In Plain Sight: Pod Security And Secrets — Kubernetes and Cloud Native Associate (KCNA) Exam Prep
- Orchestration Sprint: Four Fixes, No Walls Removed — Kubernetes and Cloud Native Associate (KCNA) Exam Prep
- Always A Way Back: Rolling, Blue/Green And Canary — Kubernetes and Cloud Native Associate (KCNA) Exam Prep
- Running, Green And Still Broken: Debugging Applications — Kubernetes and Cloud Native Associate (KCNA) Exam Prep
- Delivery Sprint: Friday At Five — Kubernetes and Cloud Native Associate (KCNA) Exam Prep
- The Image Nobody Tested: Cloud Native Principles — Kubernetes and Cloud Native Associate (KCNA) Exam Prep
- Seven Findings, Two Owners: The 4Cs And Shared Responsibility — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- Overview Sprint: Four Findings Before The Auditor — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- Copied From A Blog Post: The Kubelet — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- Port 30080 On Every Node: kube-proxy, Networking And Clients — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- Component Sprint: The Reference Build — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- Encoded Is Not Hidden: Secrets — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- One Dash Too Many: Segmentation With Network Policy — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- Who Read The Gateway Key? Audit Logging — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- Fundamentals Sprint: Four Findings, Eight Questions — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- What Outlives The Fix: Persistence And Privilege Escalation — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- The Report That Ate The Node: Denial Of Service And Malicious Code — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- One Pod Away: Network Attackers And Sensitive Data — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- Threat Model Sprint: Name It, Then Stop It — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- A Cluster's First Birthday: PKI And Connectivity — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- Forty Minutes Of Yes: Admission Control — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- Platform Sprint: Evidence, Order, Proof — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- Audit Day: Final Review — Kubernetes and Cloud Native Security Associate (KCSA) Exam Prep
- Control Plane: etcd, API Server, Scheduler, Controllers — Kubernetes: Production-Grade Container Orchestration
- Worker Nodes: kubelet, Runtime, CNI And kube-proxy — Kubernetes: Production-Grade Container Orchestration
- Jobs And CronJobs — Kubernetes: Production-Grade Container Orchestration
- Troubleshooting: Probes, Logs, exec And CrashLoopBackOff — Kubernetes: Production-Grade Container Orchestration
- Troubleshooting: ImagePullBackOff And Failed Rollouts — Kubernetes: Production-Grade Container Orchestration
- Windows Event Logs, Sysmon & Linux Auditd Telemetry — Security Operations & Threat Hunting (SOC)