Would you like to learn how to install the Kubernetes Dashboard and enable user authentication? In this tutorial, we are going to show you how to install the Kubernetes Dashboard and enable the authentication using the username and password on a computer running Ubuntu Linux.
• Ubuntu 20
• Ubuntu 19
• Ubuntu 18
• Kubernetes 1.18
This tutorial assumes that you have a Kubernetes master node installed.
In our example, The Kubernetes node IP address is 192.168.15.200.
Kubernetes – Tutorials
On this page, we offer quick access to a list of tutorials related to Kubernetes.
Tutorial Kubernetes Dashboard – Enable user authentication
Install the list of required packages.
Download the required YAML file.
Edit this YAML file.
Locate the area named DEPLOYMENT and add the following configuration.
Here is the DEPLOYMENT area, before our configuration.
Here is the DEPLOYMENT area, after our configuration.
Install the required Kubernetes Dashboard configuration.
Here is the command output.
Create the Kubernetes Dashboard password file.
Here is the file content.
In our example, we created a user account named ADMIN and configured the password ADMINPASS123.
Edit the Kubernetes API configuration file.
Locate the area named VOLUMES and add the following configuration.
Here is the VOLUMES area, before our configuration.
Here is the VOLUMES area, after our configuration.
Locate the area named VOLUMEMOUNTS and add the following configuration.
Here is the VOLUMEMOUNTS area, before our configuration.
Here is the VOLUMEMOUNTS area, after our configuration.
Locate the area named COMMAND and add the following configuration.
Here is the COMMAND area, before our configuration.
Here is the COMMAND area, after our configuration.
After changing the Kubernetes API configuration file, the system will automatically delete the PODs using the older configuration.
The system will also generate new PODs using the new configuration.
This can take between 1 and 5 minutes.
You can monitor the Syslog file to verify this process.
Wait for this process to finish.
Start the proxy to enable access to the Kubernetes Dashboard.
Important! Access to the Kubernetes dashboard over HTTP is only allowed to the Localhost.
If this computer has a graphical interface, open your browser and access the following URL:
• http://127.0.0.1:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/
The Kubernetes Dashboard login interface should be displayed.
Select the Basic option and enter the username and password previously created.
• Username: admin
• Password: adminpass123
After a successful login, the Kubernetes Dashboard should be presented.
You have finished the Kubernetes Dashboard configuration to use the Basic authentication.
Kubernetes Dashboard – Remote access using Apache proxy
Access to the Kubernetes dashboard over HTTP is only allowed to the Localhost.
Let’s use Apache as a proxy to allow remote access on the Kubernetes Dashboard.
On the Master node, install the Apache server.
Enable the required Apache modules.
Edit the Apache configuration file.
Add the following lines at the end of this file.
Create a private key and the certificate using the OpenSSL command.
Enter the requested information.
On the option named COMMON_NAME, you need to enter the IP address or hostname.
In our example, we used the IP address: 192.168.15.200
Edit the Apache configuration file for the default website.
Here is the file, before our configuration.
Here is the file, after our configuration.
In our example, we redirected HTTP users to the HTTPS version of the website.
In our example, the Apache server will work as a proxy and send all requests to the Kubernetes proxy.
In our example, we used self-signed certificates.
Restart the Apache service.
Start the proxy to enable access to the Kubernetes Dashboard.
Open your browser and enter the IP address of your web server.
In our example, the following URL was entered in the Browser:
• https://192.168.15.200/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/login
The Apache server will work as a proxy and display the Kubernetes Dashboard.
Select the Basic option and enter the username and password previously created.
• Username: admin
• Password: adminpass123
After a successful login, the Kubernetes Dashboard should be presented.
Congratulations! You successfully finished the configuration of Apache as a proxy to the Kubernetes Dashboard.