sk1/prepare-app.sh

41 lines
1.1 KiB
Bash
Raw Normal View History

2023-05-13 17:15:43 +00:00
#!/bin/bash
#!/bin/bash
# Set variables
resourceGroupName="iban-app"
aksClusterName="ibanapp"
nodeCount=1
# Create resource group if it does not exist
if [ $(az group exists --name $resourceGroupName) == "false" ]
then
az group create --name $resourceGroupName --location eastus
fi
az aks create --resource-group $resourceGroupName --name $aksClusterName --node-count $nodeCount --generate-ssh-keys
az aks get-credentials --resource-group $resourceGroupName --name $aksClusterName
kubectl config use-context $aksClusterName
# create namespace
kubectl apply -f namespace.yaml
# create mysql secrets
kubectl create secret generic mysql-secret --from-literal=password=dromedario -n ibanweb
# create mysql statefulset and service
kubectl apply -f statefulset.yaml
kubectl apply -f service.yaml
# create phpmyadmin deployment
kubectl apply -f deployment.yaml
# expose phpmyadmin deployment
kubectl expose deployment phpmyadmin --type=LoadBalancer --port=80 --target-port=80 -n ibanweb
# Get the public IP address of the Kubernetes service
kubectl get service phpmyadmin -n ibanweb -o jsonpath='{.status.loadBalancer.ingress[0].ip}'