- A simple users CRUD app where users can be created, edited, viewed and deleted.
- Written in Spring Boot
- Backed by MySQL database
-
Create AKS cluster using terraform.
-
Note: AZ cli installed and configured
-
$ cd infra $ terraform init $ terraform plan $ terraform apply
-
Get Resource Group Name
resource_group_name=$(terraform output -raw resource_group_name)
-
Get Cluster Name
$ az aks list \
--resource-group $resource_group_name \
--query "[].{\"K8s cluster name\":name}" \
--output table
$ docker build <dockerhub_user>/usersapp:latest .
$ docker login -u <user>
$ docker push <dockerhub_user>/usersapp:latest .
- Note Kubectl Configured.
-
$ cd infra $ echo "$(terraform output kube_config)" > ./azurek8s $ export KUBECONFIG=./azurek8s $ kubectl get nodes $ cd .. $ kubectl apply -f ./k8s $ kubectl get all
-
$ az ad sp create-for-rbac \ --name "ghActionAzureRbac" \ --scope /subscriptions/a940bee1-b520-434a-85a4-ab091a8ddf1e/resourceGroups/rg-tender-lioness \ --role Contributor \ --sdk-auth
- Get json output and add as Secret variable value AZURE_CREDS
- Set DOCKERHUB_USER and DOCKERHUB_PASSWORD secrets
-
Get kubernetes loadbalancer IP
kubectl get service server-api
-
Create User:
$ curl -X POST \ http://20.231.239.89:8080/users \ -d '{ "firstName": "test", "lastName": "test1234", "username": "testuser", "password": "testpassword", "salary": "10000", "age": "28" }'
`
-
Get Users:
$ curl -X GET \ http://20.231.239.89:8080/users
-
Get User:
$ curl -X GET \ http://20.231.239.89:8080/users/3
-
Update User:
$ curl -X PUT \ http://20.231.239.89:8080/users/3 \ -d '{ "id": 3, "firstName": "test", "lastName": "test1234", "username": "testusernew", "password": "testpassword", "salary": "20000", "age": "29" }'
-
Delete User:
$ curl -X DELETE \
http://20.231.239.89:8080/users/4