This is the process I used to connect to the Grafana web server that gets deployed when adding the Prometheus Operator from the Civo Kubernetes Marketplace. If you want to dive straight in, you can use the quick start below, or see the steps to get to that point by following along with the guide.
If you already have a Kubernetes cluster running Prometheus Operator, the command to access it at http://localhost:8080 will be:
kubectl port-forward $(kubectl get pods -n monitoring -o name | sls grafana) 8080:3000 -n monitoring
kubectl port-forward $(kubectl get pods -n monitoring -o name | grep grafana) 8080:3000 -n monitoring
kubectlcommand line tool installed
- Deploy a kubernetes cluster with the Prometheus Operator app selected.
- Have the config file for your cluster downloaded. You can either do this through the web UI:
Or, alternatively, you can use the Civo CLI tool and run civo k8s config
Add the configuration file to your shell:
Set the path to
$Env:KUBECONFIG='<path to config file downloaded in previous step>')
export KUBECONFIG=<path to config file downloaded in previous step>
Make sure your resources are healthy:
kubectl get pods -A
Everything should be in "Running" State. Mine looked like this:
- Get the Grafana pod name. In Powershell use
kubectl get pods -n monitoring -o name | select-string grafanaand in bash terminals use
kubectl get pods -n monitoring -o name | grep grafana
- Create a port forward session to the Grafana pod which is exposed on port 3000:
kubectl port-forward --namespace monitoring <pod name> <local port>:3000
- Access the Grafana web application in a browser at:
Here are the steps from my testing in action:
In the browser you should see the Grafana log in screen, something like the below:
Log in with default credentials:
username: admin, password: prom-operator
Obviously these are insecure and the kubernetes default should not be used for anything other than testing
Once you're logged in there is a plethora of available dashboards out of the box to explore. You can also create your own!
clicking the "Home" button at the top gies you a list:
You probably want to kill your proxy so it's not running, you can always use the same steps to turn it back on. Simply
Ctrl-C in the terminal with the port forward running to stop it.