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
- 167 LFX Mentorship
- 219 LFX Mentorship: Linux Kernel
- 801 Linux Foundation IT Professional Programs
- 357 Cloud Engineer IT Professional Program
- 181 Advanced Cloud Engineer IT Professional Program
- 83 DevOps Engineer IT Professional Program
- 149 Cloud Native Developer IT Professional Program
- 112 Express Training Courses
- 138 Express Courses - Discussion Forum
- 6.2K Training Courses
- 48 LFC110 Class Forum - Discontinued
- 17 LFC131 Class Forum
- 35 LFD102 Class Forum
- 227 LFD103 Class Forum
- 19 LFD110 Class Forum
- 39 LFD121 Class Forum
- 15 LFD133 Class Forum
- 7 LFD134 Class Forum
- 17 LFD137 Class Forum
- 63 LFD201 Class Forum
- 3 LFD210 Class Forum
- 5 LFD210-CN Class Forum
- 2 LFD213 Class Forum - Discontinued
- 128 LFD232 Class Forum - Discontinued
- 1 LFD233 Class Forum
- 2 LFD237 Class Forum
- 23 LFD254 Class Forum
- 697 LFD259 Class Forum
- 109 LFD272 Class Forum
- 3 LFD272-JP クラス フォーラム
- 10 LFD273 Class Forum
- 154 LFS101 Class Forum
- 1 LFS111 Class Forum
- 1 LFS112 Class Forum
- 1 LFS116 Class Forum
- 1 LFS118 Class Forum
- LFS120 Class Forum
- 7 LFS142 Class Forum
- 7 LFS144 Class Forum
- 3 LFS145 Class Forum
- 1 LFS146 Class Forum
- 3 LFS147 Class Forum
- 1 LFS148 Class Forum
- 15 LFS151 Class Forum
- 1 LFS157 Class Forum
- 34 LFS158 Class Forum
- 8 LFS162 Class Forum
- 1 LFS166 Class Forum
- 1 LFS167 Class Forum
- 3 LFS170 Class Forum
- 2 LFS171 Class Forum
- 1 LFS178 Class Forum
- 1 LFS180 Class Forum
- 1 LFS182 Class Forum
- 1 LFS183 Class Forum
- 29 LFS200 Class Forum
- 736 LFS201 Class Forum - Discontinued
- 2 LFS201-JP クラス フォーラム
- 14 LFS203 Class Forum
- 102 LFS207 Class Forum
- 1 LFS207-DE-Klassenforum
- 1 LFS207-JP クラス フォーラム
- 301 LFS211 Class Forum
- 55 LFS216 Class Forum
- 48 LFS241 Class Forum
- 48 LFS242 Class Forum
- 37 LFS243 Class Forum
- 15 LFS244 Class Forum
- LFS245 Class Forum
- LFS246 Class Forum
- 50 LFS250 Class Forum
- 1 LFS250-JP クラス フォーラム
- LFS251 Class Forum
- 155 LFS253 Class Forum
- LFS254 Class Forum
- LFS255 Class Forum
- 5 LFS256 Class Forum
- 1 LFS257 Class Forum
- 1.3K LFS258 Class Forum
- 10 LFS258-JP クラス フォーラム
- 121 LFS260 Class Forum
- 159 LFS261 Class Forum
- 41 LFS262 Class Forum
- 82 LFS263 Class Forum - Discontinued
- 15 LFS264 Class Forum - Discontinued
- 11 LFS266 Class Forum - Discontinued
- 20 LFS267 Class Forum
- 25 LFS268 Class Forum
- 31 LFS269 Class Forum
- 1 LFS270 Class Forum
- 199 LFS272 Class Forum
- 1 LFS272-JP クラス フォーラム
- LFS274 Class Forum
- 3 LFS281 Class Forum
- 10 LFW111 Class Forum
- 261 LFW211 Class Forum
- 182 LFW212 Class Forum
- 13 SKF100 Class Forum
- 1 SKF200 Class Forum
- 1 SKF201 Class Forum
- 782 Hardware
- 198 Drivers
- 68 I/O Devices
- 37 Monitors
- 96 Multimedia
- 174 Networking
- 91 Printers & Scanners
- 83 Storage
- 758 Linux Distributions
- 80 Debian
- 67 Fedora
- 15 Linux Mint
- 13 Mageia
- 23 openSUSE
- 143 Red Hat Enterprise
- 31 Slackware
- 13 SUSE Enterprise
- 348 Ubuntu
- 461 Linux System Administration
- 39 Cloud Computing
- 70 Command Line/Scripting
- Github systems admin projects
- 90 Linux Security
- 77 Network Management
- 101 System Management
- 46 Web Management
- 64 Mobile Computing
- 17 Android
- 34 Development
- 1.2K New to Linux
- 1K Getting Started with Linux
- 371 Off Topic
- 114 Introductions
- 174 Small Talk
- 19 Study Material
- 806 Programming and Development
- 304 Kernel Development
- 204 Software Development
- 1.8K Software
- 211 Applications
- 180 Command Line
- 3 Compiling/Installing
- 405 Games
- 309 Installation
- 97 All In Program
- 97 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)