Changes
Page history
Added Kubernetes memory requirements dimensioning to the tips and tricks page
authored
Jul 19, 2019
by
Martin Vanbrabant
Show whitespace changes
Inline
Side-by-side
tips-and-tricks.md
View page @
747b3308
# Tips and tricks
# Tips and tricks
## Check availability and status of Kubernetes resources
## Kubernetes troubleshooting
In a terminal connected to the master node:
(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 nodes
kubectl get deployments
kubectl get deployments
kubectl get pods
kubectl get pods
```
```
## Open a terminal to a node
### Obtain node information
From a terminal connected to the master node:
```
```
kubectl get nodes
# select a <NAME> from the left column of the output of kubectl get nodes
# select a <NAME> from the left column of the output of above
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>
ssh <NAME>
```
```
## Open a terminal to a pod
### 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 kubectl get pods
# select a <NAME> from the left column of the output of above
kubectl exec -i -t <NAME> bash
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
## Grafana dashboard definition in the Kubernetes configuration
Proceed as follows:
Proceed as follows:
*
Design the Dashboard interactively in the Grafana webinterface.
*
Design the Dashboard interactively in the Grafana webinterface.
...
@@ -47,3 +74,4 @@ as in **launch-experiment.sh** in the
...
@@ -47,3 +74,4 @@ as in **launch-experiment.sh** in the
--from-file=dashboard1.json=dashboard1.json \
--from-file=dashboard1.json=dashboard1.json \
```
```