# K8S micro lab

Date: 2022-04-22

# How I installed K8s on old Laptop.

I found Acer E15, which is a decent laptop, in the recycling center and decided to turn it into my K8s lab.

**It's not an instruction how to do it, but a log of how I did it.**

**It's not a secure installation ! Don't use it on production**

If you have any questions regarding what I did here, feel free to contact me.

1. [Install Xubuntu](https://xubuntu.org/download/)
2. Solve the wifi problem 
   ```Bash
   sudo apt install bcmwl-kernel-source linux-firmware
   sudo reboot
   ```
3. Keeping the laptop running after I close the screen
   ```bash
   sudo vim /etc/systemd/logind.conf
   ```
   ```
   HandleLidSwitch=ignore
   LidSwitchIgnoreInhibited=no
   ```
   ```bash
   sudo service systemd-logind restart
   ```

4. [Install K8s](https://www.atlantic.net/dedicated-server-hosting/how-to-set-up-three-node-kubernetes-cluster-on-ubuntu-20-04/)
5. Fix the DNS pending error
   ```
    kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
   ```
6. [Install Dashboard](https://github.com/kubernetes/dashboard/blob/master/docs/user/access-control/creating-sample-user.md)
   ```
   kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.5.0/aio/deploy/recommended.yaml
   ```
7. Install nginx as reverse proxy to the dashboard + [https](https://www.digitalocean.com/community/tutorials/how-to-create-a-self-signed-ssl-certificate-for-nginx-in-ubuntu-16-04)
8. ```
   curl http://localhost:8001
   curl: (7) Failed to connect to localhost port 8001: Connection refused
   ```
   -> restart
9. ```
   kubectl get pods --all-namespaces
   The connection to the server 192.168.1.112:6443 was refused - did you specify the right host or port?
   ```
   -> 
   ```
   sudo -i
   swapoff -a
   exit
   strace -eopenat kubectl version
   ```
10. Open the [dashboard](https://192.168.1.112/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/)
