kubectl -n <your-namespace> apply -f nginx.yaml
Enable port forwarding:
kubectl -n <your-namespace> port-forward svc/nginx 18080:80
Generate load:
python3 generate_load.py
kubectl -n <your-namespace> patch deployment nginx --patch-file nginx_patch.yaml
To undo the patch:
kubectl -n <your-namespace> rollout undo deployment nginx
tools:
Documentation:
To install kind, you need install docker and go, then run the following commands:
go install sigs.k8s.io/[email protected] && kind create cluster --config=dev_cluster.yaml --name ws-challenge-02
1- install operator Run the following commands to install the CRDs and deploy the operator in the default namespace:
curl -sL https://github.com/prometheus-operator/prometheus-operator/releases/download/v0.73.2/bundle.yaml | kubectl create -f -
It can take a few minutes for the operator to be up and running. You can check for completion with the following command:
kubectl wait --for=condition=Ready pods -l app.kubernetes.io/name=prometheus-operator -n default
kubectl create namespace monitoring
1.- apply the ./monitoring_infra/prometheus.yaml file
kubectl apply -f ./monitoring_infra/prometheus.yaml -n monitoring
2-. verify the prometheus installation
kubectl get -n default prometheus prometheus -n monitoring
1.- create the alertmanager configurations
kubectl apply -f ./monitoring_infra/alertmanagerConfig.yaml -n monitoring
2.- apply the ./monitoring_infra/alertmanager.yaml file
kubectl apply -f ./monitoring_infra/alertmanager.yaml -n monitoring
3-. verify the alertmanager installation
kubectl get alertmanager main -n monitoring
To install grafana, run the following steps:
1.- Set the configmaps with the grafana configuration and the datasources
kubectl create configmap grafana-config --from-file=./monitoring_infra/grafana.ini -n monitoring
kubectl create configmap grafana-datasources --from-file=./monitoring_infra/datasources.yaml -n monitoring
kubectl create -f ./monitoring_infra/alertmanagerConfig.yaml -n monitoring
kubectl apply -f ./monitoring_infra/grafana.yaml -n monitoring
To verify the installation, run the following command:
kubectl get service grafana -n monitoring
1.- generate the service namespace
kubectl create namespace ws-challenger-03
2.- apply the service-monitor.yaml file
kubectl apply -f service_monitor.yaml -n ws-challenger-03
3-. verify the service monitor installation
kubectl get -n ws-challenger-03 servicemonitor nginx
1 - Deploy the application
kubectl -n ws-challenger-03 apply -f nginx.yaml
2 - verify the deployment
kubectl -n ws-challenger-03 get pods