This project demonstrates how to deploy a simple HelloWorld application on Azure Kubernetes Service (AKS) using a lightweight virtual machine size and a Flexible MySQL Server. It includes database setup, secret management, and Helm deployment.
- Azure CLI
- kubectl
- Helm
- MySQL client
- A valid Azure account
Use the smallest supported VM SKU for AKS system node pools: Standard_B2s (2 vCPUs, 4GB RAM).
az aks create \
--resource-group HelloWorld \
--name HelloWorld \
--node-count 1 \
--node-vm-size Standard_B2s \
--generate-ssh-keysGet cluster credentials:
az aks get-credentials --resource-group HelloWorld --name HelloWorld
kubectl config current-context
kubectl get nodesaz mysql flexible-server create \
--resource-group HelloWorld \
--name helloworddev123 \
--location centralus \
--admin-user helloworld \
--admin-password 'dDWioih2d54wqwq3' \
--sku-name Standard_B1s \
--tier Burstable \
--version 8.0 \
--storage-size 20 \
--public-access 0.0.0.0Connect to the server:
mysql -h helloworddev123.mysql.database.azure.com -u helloworld -pThen run the following SQL:
CREATE DATABASE helloword;
USE helloword;
CREATE TABLE Users (
id INT AUTO_INCREMENT PRIMARY KEY,
name VARCHAR(100),
email VARCHAR(100)
);
INSERT INTO Users (name, email) VALUES
('Alice', 'alice@example.com'),
('Bob', 'bob@example.com');
SELECT * FROM Users;kubectl create secret generic db-secret \
--from-literal=DB_PASSWORD=dDWioih2d54wqwq3Optional: Base64-encode values (for Helm chart values):
echo -n 'helloworddev123.mysql.database.azure.com' | base64
echo -n 'helloword' | base64
echo -n 'helloworld' | base64
echo -n 'dDWioih2d54wqwq3' | base64Install the chart:
helm install helloworld ./helloworld-chartCheck resources:
helm list -n helloworld
kubectl get pods -n helloworld
kubectl get svc -n helloworldExample output:
helloworld-service LoadBalancer <CLUSTER-IP> <EXTERNAL-IP> 80:PORT/TCP AGE
Replace <EXTERNAL-IP> with the value from the previous step.
Health Check:
curl http://<EXTERNAL-IP>/healthExpected response:
{"status": "healthy"}Users Endpoint:
curl http://<EXTERNAL-IP>/usersExpected response:
[
{"id":1,"name":"Alice","email":"alice@example.com"},
{"id":2,"name":"Bob","email":"bob@example.com"}
]Check logs (optional):
kubectl logs -n helloworld deploy/helloworld-deploymentUninstall everything:
helm uninstall helloworld -n helloworld
kubectl delete namespace helloworldStandard_B2sis the minimum VM size allowed for system node pools in AKS.- Avoid using hardcoded secrets in production—use Azure Key Vault or secret managers.
- Consider locking down public access to MySQL with VNet rules.
Happy Deploying! 🚀