These are some of the simple tips + commands I have collected from various sources (videos, blogs, twitter) over the years. Maintaining it here so that others find it useful as well.
Metrics server is a component that allows you to view the metrics of your cluster. If you would like to experiment with Horizontal Pod Autoscaling (HPA), metrics server is a necessary component in Minikube.
Within minikube
, metrics-server
is available as a add-on. If it is not enabled already, you can enable it by running the following command:
minikube addon enable metrics-server
Once it is enabled, you can view the metrics of a running pod using the following command:
kubectl top pods
This will show CPU and memory usage of the running pod.
A quick post to showcase how to print environment variables of a running pod.
A quick way to print the environment variables of a running pod is to use the following command.
kubectl exec <pod-name> -- env
For example, take a look at the sample nginx
pod with few additional (MY_POD
and PORT
) environment variables.
apiVersion: v1
kind: Pod
metadata:
name: my-pod
spec:
containers:
- image: nginx:1.14.2
name: nginx
ports:
- containerPort: 8080
env:
- name: POD_NAME
value: "my_pod"
- name: PORT
value: "8080"
Once the pod is in running state, you can use the following command to print the environment variables of the pod.
kubectl exec my-pod -- env
You can see the output as below listing the environment variables.