Deploy demo apps in a Lightweight Kubernetes K3s cluster.
Check out the official documentation for instructions on how to install and configure the K3s cluster.
There are two different applications in this monorepo:
More information about each application can be found in the documentation at the provided links. Each app is built for multi-arch images and pushed to hub.docker.com site.
The Docker images are built for AMD 64-bit, ARM 32-bit, and ARM 64-bit architectures. This allows you to run these apps inside a K3s cluster on Raspberry Pi 3 and 4 nodes, nVidia Jetson Nano nodes, Ampere ARM, and AMD 64-bit server nodes.
First start Docker Desktop on Windows and check our builders, type in the WSL
terminal:
docker buildx ls
We are currently using the default builder. Now create a new builder, which
gives us access to new multi-arch features, type in the WSL
terminal:
docker buildx create --name mybuilder
docker buildx use mybuilder
docker buildx inspect --bootstrap
Here is a new builder instance with the name mybilder, switched to it, and inspected it. Now you can build multi-arch images for each application.
This is a example command, type in the WSL
terminal:
docker buildx build --platform linux/amd64,linux/arm64 -t mdsanima/app --push .
This command create multi-arch images for linux/amd64
and linux/arm64
architecture then pushing to docker hub repository.
Do not execute this command this is a only example, for each application this
command is available inside apps folder on README.md
files.
This is a documentation how to troubleshooting your application.
Create the simple nginx
pod:
kubectl run nginx-shell-demo --image=nginx
Verify that the container is running:
kubectl get pod nginx-shell-demo
Get a shell to the running container:
kubectl exec --stdin --tty nginx-shell-demo -- /bin/bash
Now you are inside the pod.
Delete the demo pod:
kubectl delete pod nginx-shell-demo
Edit your /etc/hosts
file and add this line:
192.168.1.30 kube.mdsanima.local rpi-1.node.test hello.dev.local mdsanima.dev.local
Now you can assess at the URL like this http://kube.mdsanima.local or this http://rpi-1.node.test:31337 specific node port services. You can type anything you want.
This config may be different of any your node. Also you can change it in WSL
and if you want to access browser on Windows you need to change it in other
location. Open the Windows Terminal with Administrator mode on your WSL
system. I use Ubuntu 22.04 LTS Jammy
. Type this command
nano /mnt/c/Windows/System32/drivers/etc/hosts
and add your host name.
When new image is pushing to the repository you can restart the deployment:
kubectl rollout restart deploy hello-world
kubectl rollout restart deploy hello-mdsanima
After executing these commands, new images will be downloaded.
Here is a instruction guide for install the NGINX Ingress Controller from official documentation site.
You can deploy the ingress controller with the following command:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.6.4/deploy/static/provider/cloud/deploy.yaml
Now check the namespace, pods and services with short version commands:
kubectl get ns
kubectl get pod --namespace=ingress-nginx
kubectl get svc --namespace=ingress-nginx