Lab 4.1, exec'ing into etcd container fails due to lack of shell
Way at the top of the lab, there's this:student@cp:˜$ kubectl -n kube-system exec -it etcd-<Tab> -- sh
On my end, I'm getting this complaint back:
username@control-plane:~$ kubectl exec -it --namespace kube-system etcd-cp -- sh error: Internal error occurred: Internal error occurred: error executing command in container: failed to exec in container: failed to start exec "<REDACTED_ID>": OCI runtime exec failed: exec failed: unable to start container process: exec: "sh": executable file not found in $PATH
Of course there's no such error if I try to call -- etcdctl instead of -- sh. I figure at some point that container went toolless? Is that right?
Answers
-
Did you try
/bin/sh?0 -
Yes. Same error. I'll note though, I'm upgrading 1.34.2 to 1.34.3. So a bit newer than the versions specified in the lab.
I also checked for other ultra-common tools such as ls, even
echo *gives the same error.I mean I've worked around it, I'm just wondering if it's PEBKAC or if it's the course materials.
0 -
Hi @josefassad,
I just verified on both Kubernetes v1.33.1 (etcd 3.5.21) and v1.34.1 (etcd 3.6.4) the command behaves as presented in the lab guide.
-- shallowed me to executepwd,cd, and evenecho *inside theetcdcontainer of theetcd-cppod.-- sh -c 'echo *'also worked.-- sh -c 'etcdctl'and-- etcdctlalso worked.I recommend checking the official etcd.io site for any known issues or bugs and suggested workarounds or fixes.
Regards,
-Chris0 -
Hi Chris,
Thanks for checking! What an odd thing.
At any rate I have an effective workaround so I'm not too bothered. I appreciate the time you took to try to reproduce.
0 -
Hang on, let me be a bit more persistent. Looking at the etcd source I see from the Dockerfile the image is built on Distroless and contains little else than etcd, etcdctl, and etcdutl.
On the one hand that explains why I can only run those in a
kubectl exec. On the other hand, now I'm wondering why @chrispokorni 's image has more things in it.I'm still thinking PEBKAC but I'm intrigued.
0 -
I have the same issue.
@josefassad what did you do as a workaround? I'm thinking of creating an etcdctl deployment for running these commands, or maybe just installing it directly on the control plane host.
0 -
@chriswood123 my workaround is a lot simpler, I just call etcdctl directly. So if the lab says something like
kubectl -n kube-system exec -it etcd-cp -- sh \ -c "ETCDCTL_API=3 \ ETCDCTL_CACERT=/etc/kubernetes/pki/etcd/ca.crt \ ETCDCTL_CERT=/etc/kubernetes/pki/etcd/server.crt \ ETCDCTL_KEY=/etc/kubernetes/pki/etcd/server.key \ etcdctl endpoint health"
I'm calling
kubectl exec -ti -n kube-system etcd-cp -- etcdctl \ --cacert=/etc/kubernetes/pki/etcd/ca.crt \ --cert=/etc/kubernetes/pki/etcd/server.crt \ --key=/etc/kubernetes/pki/etcd/server.key \ endpoint health
I figured this out when I looked at the current etcd image's Dockerfile. They're using distroless and copying the etcd binaries over. So I just configured the
etcdctlinvocation using flags instead of environment variables.Hope this works for you!
0 -
Hi @josefassad and @chriswood123,
Would you mind providing the etcd version that you are reporting about? This would help the course maintainer determine if these are isolated incidents or perhaps more generic across multiple etcd releases, requiring a permanent solution within the lab exercises.
You can find the version with either one of the two commands below:
kubectl -n kube-system exec etcd-cp -- etcdctl version kubectl -n kube-system describe pod etcd-cp | grep Image:
As I posted earlier, when I tried to reproduce the issue, all commands worked as presented in the lab guide. I attempted to reproduce the issue on two Kubernetes releases: v1.33.1 (etcd 3.5.21) and v1.34.1 (etcd 3.6.4).
Regards,
-Chris0 -
Hi @chrispokorni . You bet. I'll actually grab version strings from kubeadm too since that's the fella that got me this version of etcd.
josef@control-plane:~/tmp/echo-server$ kubectl exec -n kube-system etcd-cp -- etcdctl version | cowsay _________________________________________ < etcdctl version: 3.6.5 API version: 3.6 > ----------------------------------------- \ ^__^ \ (oo)\_______ (__)\ )\/\ ||----w | || || josef@control-plane:~/tmp/echo-server$ kubeadm version kubeadm version: &version.Info{Major:"1", Minor:"34", EmulationMajor:"", EmulationMinor:"", MinCompatibilityMajor:"", MinCompatibilityMinor:"", GitVersion:"v1.34.3", GitCommit:"df11db1c0f08fab3c0baee1e5ce6efbf816af7f1", GitTreeState:"clean", BuildDate:"2025-12-09T15:05:15Z", GoVersion:"go1.24.11", Compiler:"gc", Platform:"linux/amd64"}So digging around a bit, here's what I think is going on. I was naughty and used k8s 1.34 when in fact Lab 3.1 said to use 1.33. Looking at the k8s changelog for 1.34, I note the following:
Updated etcd version to v3.6.0. (#131501, @joshjms) [SIG API Machinery, Cloud Provider, Cluster Lifecycle, Etcd and Testing]
Looking at the corresponding etcd changelog, you can see they went distroless (Dockerfile for reference). A whole four years ago!
It's distroless, so there's no busybox or any other kind of userland in there. Hence no
bashorsh. So as far as hypotheses go, this one only has one weakness: that you tested against a 1.34 line and found a shell in the etcd container.0
Categories
- All Categories
- 158 LFX Mentorship
- 158 LFX Mentorship: Linux Kernel
- 869 Linux Foundation IT Professional Programs
- 392 Cloud Engineer IT Professional Program
- 190 Advanced Cloud Engineer IT Professional Program
- 94 DevOps IT Professional Program
- DevOps & GitOps IT Professional Program
- 162 Cloud Native Developer IT Professional Program
- 153 Express Training Courses & Microlearning
- 150 Express Courses - Discussion Forum
- 3 Microlearning - Discussion Forum
- 7.3K Training Courses
- 50 LFC110 Class Forum - Discontinued
- 74 LFC131 Class Forum - DISCONTINUED
- 58 LFD102 Class Forum
- 261 LFD103 Class Forum
- LFD103-JP クラス フォーラム
- 27 LFD110 Class Forum
- 50 LFD121 Class Forum
- 3 LFD123 Class Forum
- 1 LFD125 Class Forum
- 19 LFD133 Class Forum
- 10 LFD134 Class Forum
- 19 LFD137 Class Forum
- 1 LFD140 Class Forum
- 73 LFD201 Class Forum
- 8 LFD210 Class Forum
- 6 LFD210-CN Class Forum
- 2 LFD213 Class Forum - Discontinued
- LFD221 Class Forum
- 128 LFD232 Class Forum - Discontinued
- 3 LFD233 Class Forum - Discontinued
- 5 LFD237 Class Forum
- 25 LFD254 Class Forum
- 756 LFD259 Class Forum
- 111 LFD272 Class Forum - Discontinued
- 4 LFD272-JP クラス フォーラム - Discontinued
- 20 LFD273 Class Forum
- 512 LFS101 Class Forum
- 4 LFS111 Class Forum
- 4 LFS112 Class Forum
- LFS114 Class Forum
- 5 LFS116 Class Forum
- 9 LFS118 Class Forum
- 2 LFS120 Class Forum
- LFS140 Class Forum
- 12 LFS142 Class Forum
- 9 LFS144 Class Forum
- 6 LFS145 Class Forum
- 6 LFS146 Class Forum
- 7 LFS147 Class Forum
- 22 LFS148 Class Forum
- 19 LFS151 Class Forum
- 6 LFS157 Class Forum
- 92 LFS158 Class Forum
- 1 LFS158-JP クラス フォーラム
- 14 LFS162 Class Forum
- 2 LFS166 Class Forum - Discontinued
- 9 LFS167 Class Forum
- 5 LFS170 Class Forum
- 2 LFS171 Class Forum - Discontinued
- 4 LFS178 Class Forum - Discontinued
- 4 LFS180 Class Forum
- 3 LFS182 Class Forum
- 7 LFS183 Class Forum
- 2 LFS184 Class Forum
- 41 LFS200 Class Forum
- 737 LFS201 Class Forum - Discontinued
- 3 LFS201-JP クラス フォーラム - Discontinued
- 23 LFS203 Class Forum
- 147 LFS207 Class Forum
- 3 LFS207-DE-Klassenforum
- 3 LFS207-JP クラス フォーラム
- 302 LFS211 Class Forum - Discontinued
- 56 LFS216 Class Forum - Discontinued
- 61 LFS241 Class Forum
- 51 LFS242 Class Forum
- 41 LFS243 Class Forum
- 17 LFS244 Class Forum
- 8 LFS245 Class Forum
- 1 LFS246 Class Forum
- 1 LFS248 Class Forum
- 126 LFS250 Class Forum
- 3 LFS250-JP クラス フォーラム
- 2 LFS251 Class Forum - Discontinued
- 164 LFS253 Class Forum
- 1 LFS254 Class Forum - Discontinued
- 3 LFS255 Class Forum
- 16 LFS256 Class Forum
- 2 LFS257 Class Forum
- 1.4K LFS258 Class Forum
- 12 LFS258-JP クラス フォーラム
- 142 LFS260 Class Forum
- 165 LFS261 Class Forum
- 45 LFS262 Class Forum
- 82 LFS263 Class Forum - Discontinued
- 15 LFS264 Class Forum - Discontinued
- 11 LFS266 Class Forum - Discontinued
- 25 LFS267 Class Forum
- 28 LFS268 Class Forum
- 38 LFS269 Class Forum
- 11 LFS270 Class Forum
- 202 LFS272 Class Forum - Discontinued
- 2 LFS272-JP クラス フォーラム - Discontinued
- 2 LFS274 Class Forum - Discontinued
- 4 LFS281 Class Forum - Discontinued
- 31 LFW111 Class Forum
- 265 LFW211 Class Forum
- 190 LFW212 Class Forum
- 17 SKF100 Class Forum
- 2 SKF200 Class Forum
- 3 SKF201 Class Forum
- 800 Hardware
- 200 Drivers
- 68 I/O Devices
- 37 Monitors
- 104 Multimedia
- 175 Networking
- 92 Printers & Scanners
- 85 Storage
- 765 Linux Distributions
- 82 Debian
- 67 Fedora
- 20 Linux Mint
- 13 Mageia
- 23 openSUSE
- 149 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 356 Ubuntu
- 472 Linux System Administration
- 39 Cloud Computing
- 71 Command Line/Scripting
- Github systems admin projects
- 96 Linux Security
- 78 Network Management
- 102 System Management
- 48 Web Management
- 74 Mobile Computing
- 19 Android
- 42 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 390 Off Topic
- 121 Introductions
- 180 Small Talk
- 28 Study Material
- 909 Programming and Development
- 313 Kernel Development
- 578 Software Development
- 1.8K Software
- 275 Applications
- 183 Command Line
- 5 Compiling/Installing
- 989 Games
- 320 Installation
- 110 All In Program
- 110 All In Forum
Upcoming Training
-
August 20, 2018
Kubernetes Administration (LFS458)
-
August 20, 2018
Linux System Administration (LFS301)
-
August 27, 2018
Open Source Virtualization (LFS462)
-
August 27, 2018
Linux Kernel Debugging and Security (LFD440)