To start the Kubernetes test environment, we first must ensure there's no instance of minikube running as follows:
minikube status
minikube delete
Start a new minikube instance with the following specifications:
minikube start
--cpus=2
--memory=3072
--kubernetes-version="v1.14.0"
--vm-driver=virtualbox
When the previous command finishes, a new Kubernetes environment should be ready to be used.
For our Kubernetes test environment, we'll be building upon the lessons learned in Chapter 5, Running a Prometheus Server, and using Prometheus Operator in our workflow. Since we already covered the Prometheus Operator setup, we'll deploy all the required components without going over each one of them.
Step into the following chapter number:
cd ./chapter06/
Deploy the Prometheus Operator and validate the successful deploy as follows:
kubectl apply -f ./provision/kubernetes/operator/bootstrap/
kubectl rollout status deployment/prometheus-operator -n monitoring
Use the Prometheus Operator to deploy Prometheus and ensure the deploy was successful like so:
kubectl apply -f ./provision/kubernetes/operator/deploy/
kubectl rollout status statefulset/prometheus-k8s -n monitoring
Add ServiceMonitors as shown in the following code, which will configure Prometheus jobs:
kubectl apply -f ./provision/kubernetes/operator/monitor/
kubectl get servicemonitors --all-namespaces
After a moment, you should have Prometheus available and ready; the following instruction will provide its web interface:
minikube service prometheus-service -n monitoring
You can validate the Kubernetes StatefulSet for Prometheus using the following instruction, which will open the Kubernetes dashboard:
minikube dashboard
The following screenshot illustrates the correct deployment of the Prometheus StatefulSet: