This repository contains all the necessary files and instructions to deploy an application on AWS as part of the company's course.
1.1. Create the cluster:
eksctl create cluster -f cluster.yaml1.2. Add the Bitnami Helm repository:
helm repo add bitnami https://charts.bitnami.com/bitnami1.3. Install the RabbitMQ Operator:
helm install rabbitmq-operator bitnami/rabbitmq-cluster-operatorWait for the installation to complete.
kubectl apply -f namespace.yamlkubectl apply -f storageclass.yaml4.1. Apply the RabbitMQ configuration:
kubectl apply -f rabbitmq.yamlVerify availability:
- Wait until the pods are available:
kubectl get all -l app.kubernetes.io/name=rabbitmq -n codeflix
- Ensure the status is
true:kubectl describe rmq rabbitmq -n codeflix
If it takes too long, check the logs for errors:
kubectl describe pod/rabbitmq-server-0 -n codeflixTest RabbitMQ access with port forwarding:
kubectl port-forward "service/rabbitmq" 15672 -n codeflixRetrieve the RabbitMQ username and password:
username="$(kubectl get secret rabbitmq-default-user -o jsonpath='{.data.username}' -n codeflix | base64 --decode)"
echo "username: $username"
password="$(kubectl get secret rabbitmq-default-user -o jsonpath='{.data.password}' -n codeflix | base64 --decode)"
echo "password: $password"Create the RabbitMQ secret:
kubectl create secret generic rabbitmq-secret \
--from-literal=username=adm_videos \
--from-literal=password=123456 -n codeflixApply the RabbitMQ topology:
kubectl apply -f rabbitmq-topology.yamlDeploy the database:
kubectl apply -f db.yamlWait for the database to start, then deploy the service:
kubectl apply -f db-service.yamlInstall the Keycloak Operator:
kubectl apply -f https://raw.githubusercontent.com/keycloak/keycloak-k8s-resources/26.1.4/kubernetes/keycloaks.k8s.keycloak.org-v1.yml
kubectl apply -f https://raw.githubusercontent.com/keycloak/keycloak-k8s-resources/26.1.4/kubernetes/keycloakrealmimports.k8s.keycloak.org-v1.yml
kubectl apply -f https://raw.githubusercontent.com/keycloak/keycloak-k8s-resources/26.1.4/kubernetes/kubernetes.yml -n codeflixCreate the database secrets:
kubectl create secret generic db-secret \
--from-literal=username=root \
--from-literal=password=root -n codeflixDeploy Keycloak:
kubectl apply -f keycloak.yamlCheck Keycloak readiness:
kubectl get keycloaks/keycloak -n codeflix \
-o go-template='{{range .status.conditions}}CONDITION: {{.type}}{{"\n"}} STATUS: {{.status}}{{"\n"}} MESSAGE: {{.message}}{{"\n"}}{{end}}'Apply the Keycloak realm configuration:
kubectl apply -f keycloak-import.yamlMonitor the realm import:
kubectl get keycloakrealmimports/kc-codeflix-realm -n codeflix -o go-template='{{range .status.conditions}}CONDITION: {{.type}}{{"\n"}} STATUS: {{.status}}{{"\n"}} MESSAGE: {{.message}}{{"\n"}}{{end}}'When done is true, the import was successful.
Bind the port and retrieve the Keycloak admin credentials:
kubectl port-forward service/keycloak-service 8080:80 -n codeflix
kubectl get secret example-kc-initial-admin -o jsonpath='{.data.username}' | base64 --decode
kubectl get secret example-kc-initial-admin -o jsonpath='{.data.password}' | base64 --decodeCreate the GCP credentials secret:
kubectl create secret generic gcp-credentials-secret \
--from-file=gcp_credentials.json=gcp_credentials.json -n codeflixApply the admin catalog configuration:
kubectl apply -f admin-catalog.yamlVerify the application status:
kubectl get all -n codeflix