Lab Exercises 4.1
kinda stuck here .. maybe somebody know whats wrong
if i try the example from the course :
`
kubectl -n kube-system exec -it etcd-k8s-test.panday.local -- 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"
sh: : command not found
Error: KeyFile and CertFile must both be present[key: /etc/kubernetes/pki/etcd/server.key, cert: ]
command terminated with exit code 128
markus@k8s-test:~$
`
doesnt work.. BUT
if i exec into the contaner it works just fine:
`
kubectl -n kube-system exec -it etcd-k8s-test.panday.local -- sh
sh-5.0# cd /etc/kubernetes/pki/etcd/
sh-5.0# echo *
ca.crt ca.key healthcheck-client.crt healthcheck-client.key peer.crt peer.key server.crt server.key
sh-5.0# export ETCDCTL_CACERT=/etc/kubernetes/pki/etcd/ca.crt
sh-5.0# export ETCDCTL_CERT=/etc/kubernetes/pki/etcd/server.crt
sh-5.0# export ETCDCTL_KEY=/etc/kubernetes/pki/etcd/server.key
sh-5.0# etcdctl endpoint health
127.0.0.1:2379 is healthy: successfully committed proposal: took = 78.42549ms
`
why is that? i also found out if i write everything into ONE line it works too:
markus@k8s-test:~$ kubectl -n kube-system exec -it etcd-k8s-test.panday.local -- 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" 127.0.0.1:2379 is healthy: successfully committed proposal: took = 24.602875ms markus@k8s-test:~$
so why does the example from the "course" doesnt work ?
same with the next example from the "course" :
kubectl -n kube-system exec -it etcd-k8s-test.panday.local -- sh -c "ETCDCTL_API=3 --cert=./peer.crt --key=./peer.key --cacert=./ca.crt etcdctl --endpoints=https://127.0.0.1:2379 member list" sh: --cert=./peer.crt: No such file or directory command terminated with exit code 127
what i am curious. "-c" menas execute the command.. but you start with --cert ... what command is that? should not the the etcdcctl first? and if you just execute into the container it would end up in / i guess ... so when i change your example to
markus@k8s-test:~$ kubectl -n kube-system exec -it etcd-k8s-test.panday.local -- sh -c "ETCDCTL_API=3 cd /etc/kubernetes/pki/etcd/ && etcdctl --cert=./peer.crt --key=./peer.key --cacert=./ca.crt --endpoints=https://127.0.0.1:2379 member list" 28ef24cc2b5672b, started, k8s-test.panday.local, https://192.168.89.45:2380, https://192.168.89.45:2379, false markus@k8s-test:~$
so is this just on my side that i encounter things like that?
Best Answer
-
@mmaussner It simply doesn't see your cert like as if it is not in your command. In other words it sees your command as:
kubectl -n kube-system exec -it etcd-k8s-test.panday.local -- sh -c "ETCDCTL_API=3 \ ETCDCTL_CACERT=/etc/kubernetes/pki/etcd/ca.crt \ ETCDCTL_KEY=/etc/kubernetes/pki/etcd/server.key \ etcdctl endpoint health"
And for the second part of your questions -- yes, this is mistake in training course, but seems nobody cares of fixing these mistakes) That's why I stopped posting info about them at all)
0
Answers
-
@oleksazhel thanks for your answer. and a pitty if known mistakes arent fixed.
1 -
Hi @mmaussner,
There are CLI tools that do not like back-slashes part of multi-line commands, or while copying from the PDF lab guide may introduce invisible characters that cause these CLI issues. In these cases, removing the back-slashes and converting multi-line commands into single liners should work instead.
The
./peer.crt
./peer.key
and./ca.crt
assume a relative path, achieved by cd-ing into/etc/kubernetes/pki/etcd/
. This can also be achieved by replacing the relative with the absolute paths such as/etc/kubernetes/pki/etcd/peer.crt
...In addition, the
etcdctl
command should be provided immediately after the API version 3 declaration, and not at the endRegards,
-Chris0 -
I agree that the second example in the training materials need to be corrected.
Why would you use the peer cert instead of the original cert?
How could relative paths work if we're not cd'ing into any directory as part of the command?
And how could the second command ever work if --cert=... precedes etcdctl itself?
0 -
This was posted in August 2022, March 23 I still got the same error
doing the instructions on the pdf DOESN"T work....
got the same problems...
Udemy training that cost 12uds has fewer problems/errors than training 300usd... really?I guess this will me my first and last purchase on LF
0 -
Hi @andressasso84,
Can you provide the commands that do not work and the error outputs generated as a result?
Regards,
-Chris0 -
PDF:
student@cp: ̃$ kubectl -n kube-system exec -it etcd-cp -- sh \ #Same as before
-c "ETCDCTL_API=3 \ #Version to use
ETCDCTL_CACERT=/etc/kubernetes/pki/etcd/ca.crt \ #Pass the certificate authority
ETCDCTL_CERT=/etc/kubernetes/pki/etcd/server.crt \ #Pass the peer cert and key
ETCDCTL_KEY=/etc/kubernetes/pki/etcd/server.key \
etcdctl endpoint health" #The command to test the endpointandres@kubecp1:~$ kubectl -n kube-system exec -it etcd-kubecp1 -- sh
sh-5.1# -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"sh: -c: command not found
so that -c is causing troubles..
fixed by using mmaussner recommendation..
after fixing that I was able to continue with the lab updated CP to version v1.26.3
followed the steps on the working ...
checking from CPandres@kubecp1:~$ kubectl get node
NAME STATUS ROLES AGE VERSION
kubecp1 Ready control-plane 3d2h v1.26.3
worker1 Ready 2d23h v1.26.3
andres@kubecp1:~$but if want to do the same for the worker..
andres@worker1:~$ kubectl get node
E0323 04:04:03.498604 1390985 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
E0323 04:04:03.499267 1390985 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
E0323 04:04:03.501176 1390985 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
E0323 04:04:03.502679 1390985 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
E0323 04:04:03.504033 1390985 memcache.go:265] couldn't get current server API group list: Get "http://localhost:8080/api?timeout=32s": dial tcp 127.0.0.1:8080: connect: connection refused
The connection to the server localhost:8080 was refused - did you specify the right host or port?no clue way is doing that... but again.. lab fail, now I have to waste time and troubleshoot... a good way on learning... but I would hope that the lab works ...
0 -
Hi @andressasso84,
As a result of how the Kubernetes environment is configured for this lab, the
kubectl
command is expected to fail from the worker node. The.kube/config
file is not set on the worker, and I do not believe there is a step in the lab guide presenting a successful run from the worker node either.Regards,
-Chris0
Categories
- All Categories
- 217 LFX Mentorship
- 217 LFX Mentorship: Linux Kernel
- 788 Linux Foundation IT Professional Programs
- 352 Cloud Engineer IT Professional Program
- 177 Advanced Cloud Engineer IT Professional Program
- 82 DevOps Engineer IT Professional Program
- 146 Cloud Native Developer IT Professional Program
- 137 Express Training Courses
- 137 Express Courses - Discussion Forum
- 6.2K Training Courses
- 46 LFC110 Class Forum - Discontinued
- 70 LFC131 Class Forum
- 42 LFD102 Class Forum
- 226 LFD103 Class Forum
- 18 LFD110 Class Forum
- 37 LFD121 Class Forum
- 18 LFD133 Class Forum
- 7 LFD134 Class Forum
- 18 LFD137 Class Forum
- 71 LFD201 Class Forum
- 4 LFD210 Class Forum
- 5 LFD210-CN Class Forum
- 2 LFD213 Class Forum - Discontinued
- 128 LFD232 Class Forum - Discontinued
- 2 LFD233 Class Forum
- 4 LFD237 Class Forum
- 24 LFD254 Class Forum
- 694 LFD259 Class Forum
- 111 LFD272 Class Forum
- 4 LFD272-JP クラス フォーラム
- 12 LFD273 Class Forum
- 146 LFS101 Class Forum
- 1 LFS111 Class Forum
- 3 LFS112 Class Forum
- 2 LFS116 Class Forum
- 4 LFS118 Class Forum
- 6 LFS142 Class Forum
- 5 LFS144 Class Forum
- 4 LFS145 Class Forum
- 2 LFS146 Class Forum
- 3 LFS147 Class Forum
- 1 LFS148 Class Forum
- 15 LFS151 Class Forum
- 2 LFS157 Class Forum
- 25 LFS158 Class Forum
- 7 LFS162 Class Forum
- 2 LFS166 Class Forum
- 4 LFS167 Class Forum
- 3 LFS170 Class Forum
- 2 LFS171 Class Forum
- 3 LFS178 Class Forum
- 3 LFS180 Class Forum
- 2 LFS182 Class Forum
- 5 LFS183 Class Forum
- 31 LFS200 Class Forum
- 737 LFS201 Class Forum - Discontinued
- 3 LFS201-JP クラス フォーラム
- 18 LFS203 Class Forum
- 130 LFS207 Class Forum
- 2 LFS207-DE-Klassenforum
- 1 LFS207-JP クラス フォーラム
- 302 LFS211 Class Forum
- 56 LFS216 Class Forum
- 52 LFS241 Class Forum
- 48 LFS242 Class Forum
- 38 LFS243 Class Forum
- 15 LFS244 Class Forum
- 2 LFS245 Class Forum
- LFS246 Class Forum
- 48 LFS250 Class Forum
- 2 LFS250-JP クラス フォーラム
- 1 LFS251 Class Forum
- 151 LFS253 Class Forum
- 1 LFS254 Class Forum
- 1 LFS255 Class Forum
- 7 LFS256 Class Forum
- 1 LFS257 Class Forum
- 1.2K LFS258 Class Forum
- 10 LFS258-JP クラス フォーラム
- 118 LFS260 Class Forum
- 159 LFS261 Class Forum
- 42 LFS262 Class Forum
- 82 LFS263 Class Forum - Discontinued
- 15 LFS264 Class Forum - Discontinued
- 11 LFS266 Class Forum - Discontinued
- 24 LFS267 Class Forum
- 22 LFS268 Class Forum
- 30 LFS269 Class Forum
- LFS270 Class Forum
- 202 LFS272 Class Forum
- 2 LFS272-JP クラス フォーラム
- 1 LFS274 Class Forum
- 4 LFS281 Class Forum
- 9 LFW111 Class Forum
- 259 LFW211 Class Forum
- 181 LFW212 Class Forum
- 13 SKF100 Class Forum
- 1 SKF200 Class Forum
- 1 SKF201 Class Forum
- 795 Hardware
- 199 Drivers
- 68 I/O Devices
- 37 Monitors
- 102 Multimedia
- 174 Networking
- 91 Printers & Scanners
- 85 Storage
- 758 Linux Distributions
- 82 Debian
- 67 Fedora
- 17 Linux Mint
- 13 Mageia
- 23 openSUSE
- 148 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 353 Ubuntu
- 468 Linux System Administration
- 39 Cloud Computing
- 71 Command Line/Scripting
- Github systems admin projects
- 93 Linux Security
- 78 Network Management
- 102 System Management
- 47 Web Management
- 63 Mobile Computing
- 18 Android
- 33 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 371 Off Topic
- 114 Introductions
- 174 Small Talk
- 22 Study Material
- 805 Programming and Development
- 303 Kernel Development
- 484 Software Development
- 1.8K Software
- 261 Applications
- 183 Command Line
- 3 Compiling/Installing
- 987 Games
- 317 Installation
- 96 All In Program
- 96 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)