Helm chart to install uPortal-demo on Kubernetes.
⚠️ This is a proof of concept - this is my first Helm chart - I'm sure there is plenty of room for improvement.
In the first instance MariaDB was arbitrarily chosen as something supported by uPortal and numerous cloud providers. Using MariaDB/MySQL also means it is possible to move to a "managed service" MySQL instance (using Open Service Broker for Azure).
It was also my intention not to stray too far from the spirit of uPortal-start.
I've tested this on Docker for Desktop (Windows 10) with Kubernetes installed locally and on Azure Kubernetes Service in the cloud.
Note: I needed to increase the default memory available to a Docker image in Windows 10 (Settings > Advanced > Memory Slider up to 4096 MB).
I recommend using Visual Studio Code with the Kubernetes extension.
This chart uses a very slightly modified version of uPortal-start. The modified version defaults to including support for accessing MariaDB and adds a new Docker image with some additional tools used to debug database and networking in Kubernetes (mysql-client, bind-tools and nmap).
The PORTAL_HOME environment variable and config files (global.properties, uPortal.properties, notification.properties) are set via a Kubernetes ConfigMap. The uPortal instance is currently configured not to use CAS - because the version of CAS in uPortal-demo does not support external configuration (later versions do).
Also the Docker image command line is determined by the Helm chart values.yaml.
Currently I have deployed my new Docker uportal-demo-k8s image to markmclaren/uportal-demo-k8s on DockerHub. This is because I believe Helm requires that you acquire your Docker image from a repository (this could be a private repository e.g. an instance of Azure Container Registry).
I am assuming you have a working Kubernetes cluster with Helm 3 installed. I am also assuming you have a working Ingress controller installed (I use the NGINX Ingress Controller be aware it is a two stage install.) This is necessary so that an externally accessible URL is available.
git clone https://github.com/markmclaren/uPortal-start-helm
Install the MariaDB dependency - this will download a tgz file to the charts directory inside uportal-demo-k8s.
helm dependency update uportal-demo-k8s
Make sure you have your Kubernetes context set correctly (you can use VSCode, kubectx or kubectxwin to do this).
Then whilst inside the uportal-demo-k8s directory you should be able to deploy uPortal-start with a supporting MariaDB database by doing:
helm install uportal-demo-k8s --generate-name
You can monitor the start up process using VSCode. After a little while you should hopefully be able to access your externally accessible IP address by running:
kubectl get ingress
The ADDRESS of the Ingress should give you the accessible URL. Tomcat should be accessible at:
http://<ADDRESS>/
and uPortal accessible at:
http://<ADDRESS>/uPortal
You can use Helm to list deployed releases using:
helm ls
You can check the status of the deployment with:
helm status <release-name>
You can then undeploy the release using:
helm uninstall <release-name>
VSCode/Kubernetes integration has some really nice features for troubleshooting.
- Is the ideal way to monitor the start up process of your helm chart.
- You can also easily access and follow logs.
- You can create a terminal on the running machines.
This is a proof of concept, there are other features not included:
- Using Helm secrets for encrypting the values in the ConfigMap
- HTTPS access with cert-manager.io
- Consider Kubernetes specific deployment options - e.g. a sidecar full of WARs
- Consider "production ready" topics, scaling, clustering, session affinity, monitoring etc.