I did a customized installation of Kubernetes the hardway and installed it successfully on a 2 node cluster in Hyper V (1 master 1 worker), everything works, but there's this thing that makes me scratch my head and I was wondering if anyone could give me insight about why it's happening.
etcdctl --help
Gives me the etcd v2 version of the help, and it also gives me the following Warning.
WARNING: Environment variable ETCDCTL_API is not set; defaults to etcdctl v2. Set environment variable ETCDCTL_API=3 to use v3 API or ETCDCTL_API=2 to use v2 API.
If I set the environment variable and run the command again, it's ignored:
ETCDCTL_API=3
etcdctl --help
But if I do
ETCDCTL_API=3 etcdctl --help
Then it gives me the etcd v3 version of the help, I also need to put ETCDCTL_API=3 in front of etcdctl snapshot save for it to be recognized as a valid command.
ETCDCTL_API=3 etcdctl snapshot save ~/etcd.backup \
--endpoints=https://127.0.0.1:2379 \
--cacert=/etc/etcd/ca.pem \
--cert=/etc/etcd/kubernetes.pem \
--key=/etc/etcd/kubernetes-key.pem
Why is this?
Well it turned out to be a lack of Linux knowledge. When I was following a few Kubernetes how to guides I used Bash variables all the time, what I didn't realize is that there's a difference between normal variables an environment variables.
I was doing:
And it looked right, but then I remembered the printenv command, and I didn't see what I expected, that's when I figured out there was a difference between environment variables and regular variables.
I had to add export in front of the variable statement, to make it an environment variable.
What's really cool is that after reading this
https://github.com/etcd-io/etcd/blob/master/etcdctl/README.md
I was able to make the above, become nice short commands like this: