Kubectl commands

Use kubectl commands to check on the kubernetes resources deployed in the kubernetes cluster platform like Red Hat OpenShift. On Red Hat OpenShift platform, oc command can be used besides kubectl command.

Some of the useful commands are as following:

  • List running pods in a specific namespace under Kubernetes cluster:
    kubectl get pod --namespace=<namespace_name>
    oc get pod --namespace=<namespace_name>
  • Describe the kubernetes resources in a running Kubernetes cluster:
    kubectl describe <resource_type> <resource_name>
  • Display the log file of a running pod:
    kubectl logs <pod_name> -n <namespace_name>
    oc logs <pod_name> -n <namespace_name>
  • List of ingress resources created in the Kubernetes cluster:
    kubectl get ingress --namespace=<namespace_name>
    oc get route --namespace=<namespace_name>