khadas / fenix

One-stop script set to build Ubuntu/Debian images
GNU General Public License v2.0
208 stars 135 forks source link

Load modules for running docker and microk8s #300

Closed viraniac closed 2 weeks ago

viraniac commented 2 weeks ago

Tested on vim3 ubuntu noble server image

Microk8s testing steps

1) Install snapd and microk8s

$ sudo apt-get install snapd
$ sudo snapd install microk8s --channel=1.28/stable --classic
$ sudo usermod -aG microk8s khadas
$ newgrp microk8s

Note: its important to mention the channel as 1.28/stable. Latest version of microk8s is not working with our version of Linux kernel

2) I had disabled ha-cluster addon and enabled dns, hostpath-storage and dashboard addons

microk8s disable ha-cluster
microk8s enable dashboard
microk8s enable dns
microk8s enable hostpath-storage

3) Then deployed nginx image

$ microk8s kubectl create deployment nginx --image=nginx

4) After few minutes, checked the status. Notice all pods shown in running status and are in ready state.

$ microk8s kubectl get all --all-namespaces
2024/06/27 07:22:48.898868 cmd_run.go:1129: WARNING: cannot create user data directory: failed to verify SELinux context of /home/khadas/snap: exec: "matchpathcon": executable file not found in $PATH
NAMESPACE     NAME                                             READY   STATUS    RESTARTS   AGE
default       pod/nginx-7854ff8877-ktpvw                       1/1     Running   0          46s
kube-system   pod/coredns-864597b5fd-zpp4n                     1/1     Running   0          111s
kube-system   pod/dashboard-metrics-scraper-5657497c4c-6l2kk   1/1     Running   0          18m
kube-system   pod/hostpath-provisioner-7df77bc496-jjkjh        1/1     Running   0          18m
kube-system   pod/kubernetes-dashboard-54b48fbf9-x76kt         1/1     Running   0          18m
kube-system   pod/metrics-server-6d484c6d7d-mn5tm              1/1     Running   0          18m

NAMESPACE     NAME                                TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                  AGE
default       service/kubernetes                  ClusterIP   10.152.183.1     <none>        443/TCP                  19m
kube-system   service/dashboard-metrics-scraper   ClusterIP   10.152.183.57    <none>        8000/TCP                 18m
kube-system   service/kube-dns                    ClusterIP   10.152.183.10    <none>        53/UDP,53/TCP,9153/TCP   111s
kube-system   service/kubernetes-dashboard        ClusterIP   10.152.183.175   <none>        443/TCP                  18m
kube-system   service/metrics-server              ClusterIP   10.152.183.94    <none>        443/TCP                  18m

NAMESPACE     NAME                                        READY   UP-TO-DATE   AVAILABLE   AGE
default       deployment.apps/nginx                       1/1     1            1           46s
kube-system   deployment.apps/coredns                     1/1     1            1           111s
kube-system   deployment.apps/dashboard-metrics-scraper   1/1     1            1           18m
kube-system   deployment.apps/hostpath-provisioner        1/1     1            1           18m
kube-system   deployment.apps/kubernetes-dashboard        1/1     1            1           18m
kube-system   deployment.apps/metrics-server              1/1     1            1           18m

NAMESPACE     NAME                                                   DESIRED   CURRENT   READY   AGE
default       replicaset.apps/nginx-7854ff8877                       1         1         1       46s
kube-system   replicaset.apps/coredns-864597b5fd                     1         1         1       111s
kube-system   replicaset.apps/dashboard-metrics-scraper-5657497c4c   1         1         1       18m
kube-system   replicaset.apps/hostpath-provisioner-7df77bc496        1         1         1       18m
kube-system   replicaset.apps/kubernetes-dashboard-54b48fbf9         1         1         1       18m
kube-system   replicaset.apps/metrics-server-6d484c6d7d              1         1         1       18m

Docker testing steps

1) Install docker

$ sudo apt-get install docker.io
$ sudo usermod -aG docker khadas
$ newgrp docker

2) created an ubuntu noble instance with some ports forwarded

$ docker run -it -p 1234:34567 ubuntu:noble /bin/bash