This page describes how to look at various logs by using some deployer commands that wrap the most common kubectl commands or by using kubectl directly.
Look at logs via deployer sub-commands¶
There are some deployer debug sub-commands that wrap up the most relevant kubectl logs arguments that allow conveniently checking logs with only one command.
Look at hub component logs¶
The JupyterHub component’s logs can be fetched with the deployer debug component-logs command, ran for each hub component.
These commands are standalone and don’t require running deployer use-cluster-credentials before.
Hub pod logs¶
deployer debug component-logs $CLUSTER_NAME $HUB_NAME hubProxy pod logs¶
deployer debug component-logs $CLUSTER_NAME $HUB_NAME proxyTraefik pod logs¶
deployer debug component-logs $CLUSTER_NAME $HUB_NAME traefikLook at dask-gateway logs¶
Display the logs from the dask-gateway’s most important component pods.
Dask-gateway-api pod logs¶
deployer debug component-logs $CLUSTER_NAME $HUB_NAME dask-gateway-apiDask-gateway-controller pod logs¶
deployer debug component-logs $CLUSTER_NAME $HUB_NAME dask-gateway-controllerLook at a specific user’s logs¶
Display logs from the notebook pod of a given user with the following command:
deployer debug user-logs $CLUSTER_NAME $HUB_NAME <username>Note that you don’t need the escaped username, with this command.
Look at logs via kubectl¶
Pre-requisites¶
Get the name of the cluster you want to debug and export its name as env vars. Then use the deployer to gain kubectl access into this specific cluster.
Example:
export CLUSTER_NAME=2i2c;
deployer use-cluster-credentials $CLUSTER_NAMEKubernetes autoscaler logs¶
You can find scale up or scale down events by looking for decision events
kubectl describe -n kube-system configmap cluster-autoscaler-statusKubernetes node events and status¶
Running nodes and their status
kubectl get nodesGet a node’s events from the past 1h
kubectl get events --field-selector involvedObject.kind=Node --field-selector involvedObject.name=<some-node-name>Describe a node and any related events
kubectl describe node <some-node-name> --show-events=true
Kubernetes pod events and status¶
Running pods in a namespace and their status
kubectl get pods -n <namespace>Running pods in all namespaces of the cluster and their status
kubectl get pods --all-namespacesGet a pod’s events from the past 1h
kubectl get events --field-selector involvedObject.kind=Pod --field-selector involvedObject.name=<some-pod-name>Describe a pod and any related events
kubectl describe pod <some-pod-name> --show-events=true
Kubernetes pod logs¶
You can access any pod’s logs by using the kubectl logs commands. Below are some of the most common debugging commands.
Print the logs of a pod
kubectl logs <pod_name> --namespace <pod_namespace>Print the logs for a container in a pod
kubectl logs -c <container_name> <pod_name> --namespace <pod_namespace>View the logs for a previously failed pod
kubectl logs --previous <pod_name> --namespace <pod_namespace>View the logs for all containers in a pod
kubectl logs <pod_name> --all-containers --namespace <pod_namespace>