Mock Exam Question 1

I am getting the error

-su: --cacert=/etc/kubernetes/pki/etcd/ca.crt: No such file or directory

this is the command I am using
ETCDCTL_API=3 etcdctl --endpoints=127.0.0.1:2379 snapshot save /opt/etcd-backup.db \ > --cacert=/etc/kubernetes/pki/etcd/ca.crt \ > --cert=/etc/kubernetes/pki/etcd/server.crt \ > --key=/etc/kubernetes/pki/etcd/peer.key

The correct key is server.key not peer.key. :slightly_smiling_face:

i am still getting the same error

i used the below code

ETCDCTL_API=3 etcdctl --endpoints=127.0.0.1:2379 snapshot save /opt/etcd-backup.db \ > --cacert=/etc/kubernetes/pki/etcd/ca.crt \ > --cert=/etc/kubernetes/pki/etcd/server.crt \ > --key=/etc/kubernetes/pki/etcd/server.key

and the error I am getting is

-su: --cacert=/etc/kubernetes/pki/etcd/ca.crt: No such file or directory

Assuming etcd client is installed, it should work:

root@controlplane ~ ➜ ETCDCTL_API=3 etcdctl --endpoints=127.0.0.1:2379 snapshot save /opt/etcd-backup.db \ > --cacert=/etc/kubernetes/pki/etcd/ca.crt \ > --cert=/etc/kubernetes/pki/etcd/server.crt \ > --key=/etc/kubernetes/pki/etcd/server.key
-su: --cacert=/etc/kubernetes/pki/etcd/ca.crt: No such file or directory

root@controlplane ~ :heavy_multiplication_x: ETCDCTL_API=3 etcdctl --endpoints=127.0.0.1:2379 snapshot save /opt/etcd-backup.db --cacert=/etc/kubernetes/pki/etcd/ca.crt --cert=/etc/kubernetes/pki/etcd/server.crt --key=/etc/kubernetes/pki/etcd/server.key
Snapshot saved at /opt/etcd-backup.db

thank you so much it work.

I am wondering during the solution video mumshad used the > and it worked for him . Why is that?

:ok_hand:

You can break down the long command in multiple lines by using \ at the end of each line and when you do that, you get a prompt of “>” at the beginning of the new line.

It is just a matter of preference.

1 Like