Deploy WeightTracker App using Azure Kubernetes Cluster, Plus deployment with helm option.
First of all we will create a Kubernetes Cluster in Microsoft’s Azure Kubernetes Service (AKS) for the project infrastructure.
Once the cluster is created we are going to run our NodeWeightTracker application on top of AKS. This means that we need to write all the configuration files that are needed for running our application in a Kubernetes Cluster.
Finally we will, update or CI/CD process to deploy our already dockerized application into the Kubernetes cluster.
- Provision an AKS cluster
- Install the Nginx ingress controller
- Deploy the NodeWeightTracker application on AKS meeting the following requirements:
- The NodeWeightTracker application must be accessible from the internet
- The NodeWeightTracker application must be exposed to the internet on port 80
- The NodeWeightTracker must have at least 3 instances to ensure high availability
- Use configmaps/secrets to store your application configurations
- You must expose your application using the ingress controller
- Helm: Package your kubernetes manifests using helm and use it to deploy your application in your CI/CD pipeline.
- PostgreSQL on Kubernetes: Instead of using the PostgreSQL managed service of Azure, deploy the database into the AKS cluster (ensure the database is accessible only within the cluster)
- Terraform: Manage your Azure resources using Infrastructure as Code
- Create two environments using terraform aks module at Terraform-AKS directory
- Install Ngnix ingress controller using the following command:
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.0.4/deploy/static/provider/cloud/deploy.yaml
- Link the repository to the pipeline (Azure DevOps Pipeline for example).
- Create variable group for each environment including the following variables:
HOST=''
HOST_URL=''
k8s_conn='Your k8s connection name'
NODE_ENV='development'
OKTA_CLIENT_ID=''
OKTA_CLIENT_SECRET=''
OKTA_ORG_URL=''
COOKIE_ENCRYPT_PWD=''
PGDATABASE='postgres'
PGHOST='my-postgresql3'/'Your PGHOST ip/name'
PGPASSWORD='Your password'
PGPORT='5432'
PGUSERNAME='postgres'
PORT='8080'
CLUSTER_LOGIN='Your cluster connection command'
- Follow instructions for k8s+Helm deploy at
charts
directory -> charts directory. - Follow instructions for k8s deploy at
k8s
directory -> k8s directory.
This sample application demonstrates the following technologies.
- hapi - a wonderful Node.js application framework
- PostgreSQL - a popular relational database
- Postgres - a new PostgreSQL client for Node.js
- Vue.js - a popular front-end library
- Bulma - a great CSS framework based on Flexbox
- EJS - a great template library for server-side HTML templates
Requirements:
- Node.js 14.x
- PostgreSQL (can be installed locally using Docker)
- Free Okta developer account for account registration, login
- Clone or download source files
- Run
npm install
to install dependencies - If you don't already have PostgreSQL, set up using Docker
- Create a free Okta developer account and add a web application for this app
- Copy
.env.sample
to.env
and change theOKTA_*
values to your application - Initialize the PostgreSQL database by running
npm run initdb
- Run
npm run dev
to start Node.js
The associated blog post goes into more detail on how to set up PostgreSQL with Docker and how to configure your Okta account.