|
|
# Tips and tricks
|
|
|
|
|
|
## Check availability and status of Kubernetes resources
|
|
|
In a terminal connected to the master node:
|
|
|
## Kubernetes troubleshooting
|
|
|
|
|
|
(For much more, see [Kubernetes](https://kubernetes.io/).)
|
|
|
|
|
|
Execute commands listed below in a terminal connected to the master node.
|
|
|
|
|
|
### Get an overview
|
|
|
```
|
|
|
kubectl get nodes
|
|
|
kubectl get deployments
|
|
|
kubectl get pods
|
|
|
```
|
|
|
|
|
|
## Open a terminal to a node
|
|
|
From a terminal connected to the master node:
|
|
|
### Obtain node information
|
|
|
```
|
|
|
kubectl get nodes
|
|
|
# select a <NAME> from the left column of the output of above
|
|
|
# select a <NAME> from the left column of the output of kubectl get nodes
|
|
|
kubectl describe node <NAME>
|
|
|
```
|
|
|
|
|
|
### Open a terminal to a node
|
|
|
```
|
|
|
# select a <NAME> from the left column of the output of kubectl get nodes
|
|
|
ssh <NAME>
|
|
|
```
|
|
|
|
|
|
## Open a terminal to a pod
|
|
|
From a terminal connected to the master node:
|
|
|
### Open a terminal to a pod
|
|
|
```
|
|
|
kubectl get pods
|
|
|
# select a <NAME> from the left column of the output of above
|
|
|
# select a <NAME> from the left column of the output of kubectl get pods
|
|
|
kubectl exec -i -t <NAME> bash
|
|
|
```
|
|
|
|
|
|
## Kubernetes memory requirements dimensioning
|
|
|
In order to obtain good values for the `spec.template.spec.containers[].resources` section of a deployment spec,
|
|
|
as in this example:
|
|
|
```
|
|
|
requests:
|
|
|
memory: "60Mi"
|
|
|
cpu: "10m"
|
|
|
limits:
|
|
|
memory: "80Mi"
|
|
|
cpu: "60m"
|
|
|
```
|
|
|
proceed as follows:
|
|
|
* Set the values high.
|
|
|
* Configure the experiment to have only 1 replica of this deployment.
|
|
|
* Make an *espec* that provides enough nodes so that the pod for this deployment runs on a node where no other pods run.
|
|
|
* Launch the experiment.
|
|
|
* Open a terminal to the pod under investigation.
|
|
|
* Monitor actual resource consumption using the *top* command.
|
|
|
* Adapt values and set number of replicas back to the desired value.
|
|
|
|
|
|
## Grafana dashboard definition in the Kubernetes configuration
|
|
|
Proceed as follows:
|
|
|
* Design the Dashboard interactively in the Grafana webinterface.
|
... | ... | @@ -47,3 +74,4 @@ as in **launch-experiment.sh** in the |
|
|
--from-file=dashboard1.json=dashboard1.json \
|
|
|
```
|
|
|
|
|
|
|