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. ## Setting Up `kubectl`: Easy Installation Guide Kubectl is a tool used to control and manage Kubernetes clusters from the command line. It helps you deploy and manage applications, view logs, and perform other tasks. You'll need it for creating your workload cluster. You can install `kubectl` using your distribution native package management, or directly downloading the release: {% tabs #operating-systems %} {% tab title="Linux" %} ```shell /// 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 ``` ```shell /// 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 ``` {% callout type="note" %} If you do not have root access on the target system, you can still install kubectl to the ~/.local/bin directory: ```shell chmod +x kubectl mkdir -p ~/.local/bin mv ./kubectl ~/.local/bin/kubectl # and then append (or prepend) ~/.local/bin to $PATH ``` {% /callout %} {% /tab %} {% tab title="macOS" %} ```shell /// 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 ``` ```shell /// 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 ``` {% /tab %} {% tab title="Windows" %} ```shell /// Windows curl.exe -LO "https://dl.k8s.io/release/v1.30.0/bin/windows/amd64/kubectl.exe" ``` {% /tab %} {% /tabs %} 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. For installing `kubelogin`, we recommend using `Krew`, the plugin manager for `kubectl`. If you wish to install `Krew` on Linux, you can: 1. Make sure that git is installed. 2. Run this command to download and install: ```shell ( 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 ) ``` 3. Add the `$HOME/.krew/bin` directory to your PATH environment variable. To do this, update your .bashrc or .zshrc file and append the following line: ```shell export PATH="${KREW_ROOT:-$HOME/.krew}/bin:$PATH" ``` and restart your shell. 4. Run `kubectl krew` to check the installation. {% callout type="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. {% /callout %} For more information and steps for installing `Krew` on Windows, please refer to the official [Krew documentation](https://krew.sigs.k8s.io/docs/user-guide/setup/install/) If you already have `Krew` installed, you can use it to install `kubelogin`: {% tabs #package-managers %} {% tab title="Krew" %} ```shell /// macOS, Linux, Windows, and ARM kubectl krew install oidc-login ``` {% /tab %} {% tab title="Chocolatey" %} ```shell /// Windows choco install kubelogin ``` {% /tab %} {% /tabs %} Alternatively, you can install it via a Github release. Then you need to make sure that it is on your path as `kubectl-oidc_login`.