Skip to content

valtech-ch/microservice-kubernetes-cluster

Repository files navigation

Microservice Kubernetes Cluster

Build Sonar Deployment Quality Gate Status

Requirements

Architecture

Azure

Setup Kubectl

az login # Login to Azure, use your @valtech.com Account
az account list --output table # Show your accounts
az account set --subscription <subscriptionId> # Set account to your Subscription.
az aks get-credentials --name vtch-kubernetes-blueprint --resource-group vtch-kubernetes-blueprint # Adds the cluster config to your kubectl config
kubectl get nodes # Lists the nodes from the cluster
kubectl get namespace # Lists the namespaces from the cluster

Apply manual configs

You can use kubectl to manually apply changes for testing

kubectl apply -f ./aks/cluster/templates/application-peer-authentication.yaml

Terraform

Local Docker Compose Setup

For testing the whole cluster locally we added a docker-compose file which runs the FE, BE, Keycloak, Kafka and MariaDB

cd ./scripts/docker-compose
docker-compose up -d
docker-compose down

Frontend

npm install # Build
npm run serve # Run

Backend Microservices

./gradlew build # Full build including cloud functions

./gradlew :file-storage:build # Build file storage microservice only
./gradlew :persistence:build # Build persistence microservice only

# Run locally
./gradlew :file-storage:bootRun
./gradlew :persistence:bootRun

Cloud Functions

./gradlew build # Full build including backend microservices
./gradlew :functions:build # Build functions only

# Run locally
./gradlew azureFunctionsRun

Kubeseal Secret Management

Have a read at https://github.com/bitnami-labs/sealed-secrets

Sample sealing of a secrert.

# Replace sealed-secrets-1614621994 by the controller name in the cluster
kubeseal \
--controller-name=sealed-secrets-1614621994 \
--controller-namespace=kube-system \
--format yaml <xyz-secret.yaml >xyz-secret-sealed.yaml