## Initiate provider
terraform init
## Apply the modules
terraform apply
aws eks --region us-east-1 update-kubeconfig --name k8s-cluster
cd app/
docker build -t duran750/simpleapptest:v1
docker push duran750/simpleapptest:v1
cd kubernetes/manifests
#Namespace:
kubectl create -f ns.yaml && \
#ConfigMap:
kubectl create -f simpleapp-cm.yaml && \
#Deployment:
kubectl create -f simpleapp.yaml && \
#Service
kubectl create -f simpleapp-svc.yaml && \
#Ingress Controller
kubectl create -f challenge-ingress.yaml
# Deploy Nginx ingress controller
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-0.32.0/deploy/static/provider/aws/deploy.yaml
# Deploy metric server
kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
curl https://raw.githubusercontent.com/helm/helm/master/scripts/get-helm-3 > get_helm.sh
chmod 700 get_helm.sh
./get_helm.sh
# Deploy Prometheus + Grafana
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts && \
helm repo update && \
helm install prometheus prometheus-community/kube-prometheus-stack -n prova
cd kubernetes/helm/elk && \
helm repo add elastic https://Helm.elastic.co && \
helm repo update && \
helm install elasticsearch elastic/elasticsearch -n prova -f elastic-values.yaml && \
helm install kibana elastic/kibana -n prova -f kibana-values.yaml && \
helm install metricbeat elastic/metricbeat -n prova && \
helm install apm-server elastic/apm-server -n prova
# Configure aws access key and secret key
aws configure
cd list_ec2_api/
# To run this script it is necessary to install the Boto3 library and configure aws cli or running in docker using env vars
pip install -r requirements.txt
python3 api/get_ec2.py
Obs: Set your AWS credentials env's
docker run -p 5000:5000 -e AWS_ACCESS_KEY_ID="" \
-e AWS_SECRET_ACCESS_KEY="" \
-e AWS_DEFAULT_REGION=us-east-1 duran750/ec2-api
Acess API in http://localhost:5000/ec2 or Swagger in http://localhost:5000/docs
*obs: Default grafana user: admin
and password is prom-operator