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 <PROJECT_ID> 

    Replace <PROJECT_ID> 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 <POD_NAME> <CONTAINER_NAME> 

    Replace <POD_NAME> with the name of the pod you want to view the logs for, and <CONTAINER_NAME> 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 <POD_NAME> 
  4. If you want to view the logs continuously (like tail -f), you can use the following command:

    kubectl logs -f <POD_NAME> <CONTAINER_NAME> 

    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.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值