Difference between kubectl exec and kubectl attach?

DevOps

Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours scrolling social media and waste money on things we forget, but won’t spend 30 minutes a day earning certifications that can change our lives.
Master in DevOps, SRE, DevSecOps & MLOps by DevOps School!

Learn from Guru Rajesh Kumar and double your salary in just one year.


Get Started Now!

kubectl attachkubectl exec
We can attach to the main process run by the container, which is not always bash. Which is the PID1. It allows us to execute any process within the container
Attach to the one running (no choice)Run any command you want to execute.