|
|
|
# Tips and tricks
|
|
|
|
|
|
|
|
## Check availability and status of Kubernetes resources
|
|
|
|
In a terminal connected to the master node:
|
|
|
|
```
|
|
|
|
kubectl get nodes
|
|
|
|
kubectl get deployments
|
|
|
|
kubectl get pods
|
|
|
|
```
|
|
|
|
|
|
|
|
## Open a terminal to a node
|
|
|
|
From a terminal connected to the master node:
|
|
|
|
```
|
|
|
|
kubectl get nodes
|
|
|
|
# select a <NAME> from the left column of the output of above
|
|
|
|
ssh <NAME>
|
|
|
|
```
|
|
|
|
|
|
|
|
## Open a terminal to a pod
|
|
|
|
From a terminal connected to the master node:
|
|
|
|
```
|
|
|
|
kubectl get pods
|
|
|
|
# select a <NAME> from the left column of the output of above
|
|
|
|
kubectl exec -i -t <NAME> bash
|
|
|
|
```
|
|
|
|
|
|
|
|
## Grafana dashboard definition in the Kubernetes configuration
|
|
|
|
Proceed as follows:
|
|
|
|
* Design the Dashboard interactively in the Grafana webinterface.
|
|
|
|
* Save the Dashboard.
|
|
|
|
* In the Dashboard's settings, click 'JSON Model'.
|
|
|
|
* Copy the JSON contents.
|
|
|
|
* Save the contents into a .json file in the Kubernetes configuration project.
|
|
|
|
* Add the .json file to the `spec.template.spec.volumes.containers[grafana].volumeMounts` section
|
|
|
|
of the Grafana configuration, as in the following example taken from **grafana.yaml** in the
|
|
|
|
[Example experiment Kubernetes configuration](https://gitlab.ilabt.imec.be/benchmarking-experiments/ex-exp-k8s-config):
|
|
|
|
```
|
|
|
|
- mountPath: /var/lib/grafana/dashboards/dashboard1.json
|
|
|
|
name: grafana-config
|
|
|
|
readOnly: true
|
|
|
|
subPath: dashboard1.json
|
|
|
|
```
|
|
|
|
* Add a line referencing the file to the `kubectl create configmap grafana-config` command in the experiment launch script,
|
|
|
|
as in **launch-experiment.sh** in the
|
|
|
|
[Example experiment Kubernetes configuration](https://gitlab.ilabt.imec.be/benchmarking-experiments/ex-exp-k8s-config):
|
|
|
|
```
|
|
|
|
--from-file=dashboard1.json=dashboard1.json \
|
|
|
|
```
|
|
|
|
|