Before you start with Syself Autopilot, you should install the necessary tools to interact with Kubernetes clusters. This section provides instruction on how to install `kubectl` and `kubelogin`. Make sure you have these tools installed before proceeding to the next sections.
## Install `kubectl`
Use `kubectl` to deploy and manage applications, view logs, and control your cluster from the command line. You'll need it for creating your workload cluster.
You can install `kubectl` using your distribution native package management, or directly downloading the release:
```console title="x86-64"
$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
$ sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
```
```console title="ARM64"
$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/arm64/kubectl"
$ sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
```
If you do not have root access on the target system, you can still install kubectl to the ~/.local/bin directory:
```console
$ chmod +x kubectl
$ mkdir -p ~/.local/bin
$ mv ./kubectl ~/.local/bin/kubectl
# and then append (or prepend) ~/.local/bin to $PATH
```
```console title="Intel"
$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/amd64/kubectl"
$ chmod +x ./kubectl
$ sudo mv ./kubectl /usr/local/bin/kubectl
$ sudo chown root: /usr/local/bin/kubectl
```
```console title="Apple Silicon"
$ curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/darwin/arm64/kubectl"
$ chmod +x ./kubectl
$ sudo mv ./kubectl /usr/local/bin/kubectl
$ sudo chown root: /usr/local/bin/kubectl
```
We recommend installing `kubectl` via [Chocolatey](https://chocolatey.org/). If you don't have Chocolatey yet, install it first from an **Administrator** PowerShell:
```powershell
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
```
Then install `kubectl` (also from an Administrator PowerShell):
```console title="Windows"
$ choco install kubernetes-cli
```
If you want to know more, refer to the official [Kubernetes documentation](https://kubernetes.io/docs/tasks/tools/#kubectl).
## Install and configure kubelogin
We use [_kubelogin_](https://github.com/int128/kubelogin) to access the management cluster. It is a plugin designed for Kubernetes OpenID Connect (OIDC) authentication.
We recommend installing `kubelogin` via `Krew`, the plugin manager for `kubectl`.
Make sure git is installed
Download and install krew
```bash
(
set -x; cd "$(mktemp -d)" &&
OS="$(uname | tr '[:upper:]' '[:lower:]')" &&
ARCH="$(uname -m | sed -e 's/x86_64/amd64/' -e 's/\(arm\)\(64\)\?.*/\1\2/' -e 's/aarch64$/arm64/')" &&
KREW="krew-${OS}_${ARCH}" &&
curl -fsSLO "https://github.com/kubernetes-sigs/krew/releases/latest/download/${KREW}.tar.gz" &&
tar zxvf "${KREW}.tar.gz" &&
./"${KREW}" install krew
)
```
Add krew to your PATH
Update your `.bashrc` or `.zshrc` and append this line:
```bash
export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"
```
Then restart your shell.
Check the installation
Run `kubectl krew`.
Install kubelogin
```console
$ kubectl krew install oidc-login
```
> [!WARNING]
> If you just ran `export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH"` instead of adding it to your shell's configuration, you will have to do it every time you open a new terminal session.
We recommend installing `kubelogin` via [Chocolatey](https://chocolatey.org/):
```console title="Windows"
# Run as Administrator
$ choco install kubelogin
```
Alternatively, you can install `kubelogin` via a [Github release](https://github.com/int128/kubelogin/releases). Then make sure it is on your path as `kubectl-oidc_login`.