Managing Applications on GKE
Introduction: Managing Your Running Application
Deploying an application is just the beginning. Once your application is running in Google Kubernetes Engine, you need to know how to manage it, monitor its health, troubleshoot issues, and make changes as requirements evolve. This lesson focuses on the essential operations you'll perform regularly, forming the core toolkit for any Kubernetes practitioner.
You'll learn how to check the status of your deployments and pods, view application logs, scale your application up or down, update it to new versions, roll back a bad release, and restart it when necessary. These operational commands give you real-time visibility and control over the actual state of your cluster, which is critical for running production applications. We'll continue working with the my-web-deploy deployment from the previous lesson.
Checking Application Status: An Overview
The first skill you need when managing Kubernetes applications is the ability to check their status. You need to know whether your deployments are healthy, how many pods are running, and whether those pods are ready to accept traffic. Kubernetes provides several commands that give you different levels of detail about your resources. Knowing which command to use in different situations is an important part of working effectively with Kubernetes.
Quick Status Checks with kubectl get
The most basic way to check your resources is with the kubectl get command. You've seen this command before, but now you'll learn how to use it more effectively. Instead of checking deployments and pods separately, you can view them together in a single command:
This command tells kubectl to retrieve both deployments and pods from the apps namespace. The output shows you both resource types in a single view:
This combined view is useful because it shows you the relationship between the deployment and its pods. The deployment shows that it wants one replica and has one replica ready. The pod shows that it's running and has been restarted zero times. If there were any problems, you'd see them immediately in this output. For example, if the pod was crashing, you'd see a high restart count. If the pod couldn't pull the image, you'd see a status like ImagePullBackOff. This quick overview is often the first thing you check when investigating issues or verifying that changes have taken effect.
