# Prerequisites

## What Will You Do

In this part, you will provision a lightweight Kubernetes cluster in your laptop/desktop.

**Estimated Time**  
Estimated time burden for this part is 10 minutes.

---

## Kubernetes on Laptop

You can provision and import any Kubernetes cluster as long as it is upstream Kubernetes compliant. We have validated the following options.

---

### Microk8s

[MicroK8s](https://microk8s.io/) is a low-ops, minimal production Kubernetes distribution well suited for workstations and desktops. Ensure you use the stable channel for a reliable outcome.

**Important**  
The k8s mgmt operator is currently only supported on laptops/desktops based on Intel/AMD processors.

#### Install

Follow the [installation process](https://microk8s.io/docs/install-alternatives) for the operating system you are installing on. High level instructions are described below.

```
microk8s install --channel=1.30/stable
```

You should see something like the following:

```
Launched: microk8s-vm
2022-09-26T20:17:27-07:00 INFO Waiting for automatic snapd restart...
microk8s (1.24/stable) v1.24.4 from Canonical✓ installed
microk8s-integrator-macos 0.1 from Canonical✓ installed
MicroK8s is up and running. See the available commands with `microk8s --help`.
```

---

#### Enable DNS

This service is required to supply address resolution services to Kubernetes. Without this service, the k8s management operator pods will not be able to reach the SaaS controller.

```
microk8s enable dns
```

You should see something like the following:

```
Infer repository core for addon dns
Enabling DNS
Applying manifest
serviceaccount/coredns created
configmap/coredns created
deployment.apps/coredns created
service/kube-dns created
clusterrole.rbac.authorization.k8s.io/coredns created
clusterrolebinding.rbac.authorization.k8s.io/coredns created
Restarting kubelet
DNS is enabled
```

---

#### Enable RBAC

MicroK8s is inherently multi-user capable. It is always desirable to have a degree of user-isolation, e.g. when multiple users are accessing a MicroK8s cluster.

```
microk8s enable rbac
```

You should see something like the following:

```
Infer repository core for addon rbac
Enabling RBAC
Reconfiguring apiserver
RBAC is enabled
```

---

#### Verify

Once installation and configuration is complete, verify if everything is in order.

```
microk8s kubectl get po -A
```

You should see something like the following:

```
NAMESPACE     NAME                                      READY   STATUS    RESTARTS   AGE
kube-system   coredns-7f9c69c78c-jmdkx                  1/1     Running   0          36m
kube-system   calico-kube-controllers-f7868dd95-c295x   1/1     Running   0          37m
kube-system   calico-node-qq6hr                         1/1     Running   0          37m
```

**Important**  
For microk8s, you need to [prefix kubectl](https://microk8s.io/docs/working-with-kubectl) commands with microk8s.

---

### Docker Desktop

[Docker Desktop](https://docs.docker.com/desktop/kubernetes/) includes a standalone Kubernetes cluster that runs locally within your Docker instance. The Kubernetes cluster runs within a Docker container on your local system, and is only for local testing.

#### Resources

- Open the Docker Desktop and click the **Settings** icon

- Click **Resources**. Ensure you have sufficient resources allocated to Docker Desktop to test and experience all parts of this exercise.

#### Enable Kubernetes

Enabling Kubernetes in Docker Desktop literally just requires "checking a box".

#### Verify

Once enabled, ensure you are able to kubectl to the Kubernetes cluster running in Docker Desktop. In the example below, we are running Kubernetes v1.21.4.

```
kubectl get node -o wide

NAME             STATUS   ROLES                  AGE   VERSION   INTERNAL-IP    EXTERNAL-IP   OS-IMAGE         KERNEL-VERSION     CONTAINER-RUNTIME
docker-desktop   Ready    control-plane,master   22h   v1.21.4   192.168.65.4   <none>        Docker Desktop   5.10.47-linuxkit   docker://20.10.8
```

---

## Recap

Congratulations! At this point, you have successfully provisioned a Kubernetes cluster on your laptop. You are ready to progress to Part-1.

---
