How to: Lab 4.1. Setup minikube and kubectl
1. Confirm minikube running `minikube status`
2. Create `kubectl` alias in `.bashrc`
   ```sh
   printf "
   # minikube kubectl
   alias kubectl='minikube kubectl --'
   " >> ~/.bashrc
   exec bash
   ```
3. Start using the alias
   ```sh
   kubectl version
   kubectl get all
   ```
4. Enable kubectl autocompletion, see `kubectl completion --help`
   ```sh
   echo "source <(kubectl completion bash)" >> ~/.bashrc # macos replace bash with zsh
   exec bash
   ```
5. The default `kubectl edit` text editor is `vi`. To change this:
   ```sh
   export KUBE_EDITOR="nano" # use nano
   export KUBE_EDITOR="vim" # use vim
   ```
6. Open the Kubernetes dashboard with `minikube dashboard`
7. Use the Kubernetes Dashboard to deploy a webserver with three replicas
   - visit url provided in browser
   - click on top right plus "+" icon
   - select `Create from form`
   - enter App name: `app`, Container image: `nginx`, Number of pods: `3`
   - click `Deploy`
8. Return to the terminal and delete created resources
   ```sh
   ctrl+c # to terminate dashboard
   kubectl get all
   kubectl delete deploy app
   ```
9. List Kubernetes clusters with `kubectl config get-contexts`
10. If you have Kubernetes cluster from both Minikube and Docker Desktop, you can switch between them:
- Set Docker Desktop cluster as current cluster: `kubectl config set-context docker-desktop`
- Set Minikube cluster as current cluster: `kubectl config set-context minikube`