Kubectl Install
This guide installs kubectl on ubuntu.
Installing kubectl
- I base this guide on this page from the kubernetes documentation
- Selecting X86-64, I can now download the file (into a new temporary directory):
1osboxes@osboxes:~$
2osboxes@osboxes:~$ mkdir yuvinst
3osboxes@osboxes:~$ cd yuvinst/
4osboxes@osboxes:~/yuvinst$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
5 % Total % Received % Xferd Average Speed Time Time Time Current
6 Dload Upload Total Spent Left Speed
7100 138 100 138 0 0 603 0 --:--:-- --:--:-- --:--:-- 602
8100 49.0M 100 49.0M 0 0 8306k 0 0:00:06 0:00:06 --:--:-- 6697k
9osboxes@osboxes:~/yuvinst$
10osboxes@osboxes:~/yuvinst$ ls -l
11total 50252
12-rw-rw-r-- 1 osboxes osboxes 51454104 May 1 05:03 kubectl
13osboxes@osboxes:~/yuvinst$
- This file is actually the kubectl binary itself.
- The install command is actually just a fancy copy/move command:
1osboxes@osboxes:~/yuvinst$ ls
2kubectl
3osboxes@osboxes:~/yuvinst$
4osboxes@osboxes:~/yuvinst$ sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
5[sudo] password for osboxes:
6osboxes@osboxes:~/yuvinst$
7osboxes@osboxes:~/yuvinst$ ls
8kubectl
9osboxes@osboxes:~/yuvinst$ rm kubectl
10osboxes@osboxes:~/yuvinst$
- I can now run kubectl:
1osboxes@osboxes:~/yuvinst$
2osboxes@osboxes:~/yuvinst$ kubectl version
3Client Version: v1.30.0
4Kustomize Version: v5.0.4-0.20230601165947-6ce0bf390ce3
5The connection to the server localhost:8080 was refused - did you specify the right host or port?
6osboxes@osboxes:~/yuvinst$
- Note that kubectl is not directed to a specific cluster yet.
We are going to create a cluster with minikube.
This is when minikube will create a configuration for kubectl in a ~/.kube directory.