command steps to check gke container log

To check the container logs of a GKE cluster, you can use the following command steps:

  1. First, make sure that you have authenticated with Google Cloud and set the current project to the one containing the GKE cluster you want to access:

    gcloud auth login gcloud config set project  

    Replace with the ID of the Google Cloud project containing the GKE cluster.

  2. Use the kubectl command-line tool to list the pods running in the GKE cluster:

    kubectl get pods 

    This will list all of the pods running in the default namespace of the GKE cluster.

  3. Identify the pod and container that you want to view the logs for. You can use the following command to view the logs for a specific container within a pod:

    kubectl logs   

    Replace with the name of the pod you want to view the logs for, and with the name of the container within the pod.

    If you're not sure of the container name, you can list the containers in the pod using the following command:

    kubectl describe pod  
  4. If you want to view the logs continuously (like tail -f), you can use the following command:

    kubectl logs -f   

    This will stream the logs to your terminal in real-time.

That's it! You can now view the container logs of a GKE cluster using the kubectl command-line tool.

你可能感兴趣的:(java,github,linux)