Install and use ingress in Microk8s integrator

Tram Ho

In this post, I need to add 1 VM to install Nginx to load balancer here I will create 1 more VM ubuntu 22.04

IPHostnamevCPURAMDISK
10.19.2.91nginx2 cores8G100G
10.19.2.92stg-026 cores12G100G
10.19.2.93stg-036 cores12G100G
10.19.2.94stg-036 cores12G100G

We install according to the model image.png

Install Nginx on Ubuntu 22.04

Connect to VM nginx (10.19.2.91)

Step 1 – Install Nginx

Update apt-install packages

Install Nginx

Step 2 – Grant HTTP Firewall Permissions

Step 3 – Check Your Web Host

Check if nginx service is working?

image.png

Enable IGRESS

To enable Microk8s Inpress Controller we use the command:

image.png

After successful activation, we will try to create an ingress file of the dashboard

Czech: ingress-dashboard.yaml

Run the command microk8s kubectl apply -f ingress-dashboard.yaml

image.png

When successful, we go to the link https://10.19.2.92/ to check

image.png

Configure nginx Reverse Proxy

Step 1: go to the hosts file to add a line at the end of the machine you are using, here I use Windows

Windows Path: C:WindowsSystem32driversetchosts

MacOS & Linux Path: /etc/hosts

image.png

Step 2: Configure nginx

Connect to VM nginx (10.19.2.91)

then go to directory: /etc/nginx/sites-enabled

create file kubernetes-dashboard.localhost.conf

copy the config and add it to the file kubernetes-dashboard.localhost.conf

Save and check the config is correct: sudo nginx -t

Restart the service:

Configure ingress-dashboard.yaml

Add the host line: kubernetes-dashboard.localhost to

Run config again: microk8s kubectl apply -f ingress-dashboard.yaml

image.png

If you find this post helpful, please give me a like and subscribe to support me. Thank you so much

References:

Share the news now

Source : Viblo