Skip to main content
Version: 3.3.x

Access and Tools

Accessing logs​

There are many different kinds of logs that are accessible using the kubectl command line tool. The following sections show examples for accessing some of these logs.

Access pod logs​

To access the logs for a pod use the kubectl logs command.

  • For example, run the following command:

    POD=$(kubectl get pods -l 'app=ep-mysql' -o jsonpath='{.items[*].metadata.name}') \
    kubectl logs pod/${POD}
    note

    Ensure that you adjust the value ep-mysql to match the label of the pod.

Access cluster event logs​

Cluster event logs give you visibility into why nodes or pods are created or deleted.

  • Run the following command to view cluster events:

    kubectl get events

Access cluster logs​

  • To see logs for all pods and nodes in a cluster, run the following command:

    kubectl cluster-info dump

Accessing a shell inside a running container​

To be able to run shell commands inside a running container use the kubectl exec command.

  • For example, run the following command:

    POD=$(kubectl get -n ${NAMESPACE} pods -l 'app=ep-cm' -o jsonpath='{.items[*].metadata.name}') \
    kubectl exec -n ${NAMESPACE} -it ${POD} -- bash -c 'echo helloworld'
    note

    Ensure that you adjust the value app=ep-cm to match the label of the pod.

Creating secure tunnel to a port of a container​

To create a secure tunnel to a port on one of the containers use the kubectl port-forward command. For more information, see the Kubernetes documentation.

For example, the following command port-forwards a Cortex Pod running in the default namespace to port 5678 on your local machine:

POD=$(kubectl get pods \
-l 'app=ep-cortex' \
-o jsonpath='{.items[*].metadata.name}') \
kubectl port-forward pod/${POD} 5678:8080
tip

Using the kubectl port-forward command is the only way to access the OSGi Felix console on the Cortex application.

Checking Docker Pull Secrets for the cluster​

  • To check the Docker Pull Secrets for the cluster, run following command:

    kubectl get secret ep-registry-creds-secret -o json | \
    jq -r '.data.".dockerconfigjson"' | base64 -d

Listing configuration of components deployed through Helm​

  • To list the configuration of components deployed through Helm, run the following command: helm get manifest.