# ๐ Important GCP Commands for Developers
## ๐ Cloud Run Logs & Monitoring
๐น View Cloud Run Logs
gcloud logs read --format=json --limit=50
๐น View Logs for a Specific Service
gcloud run logs read nest-app --region us-central1
๐น Stream Logs in Real-Time
gcloud run logs tail --region us-central1
## ๐ Kubernetes (kubectl) Logs & Monitoring
๐น View Logs for a Pod
kubectl logs <pod-name>
๐น View Logs for a Pod with Multiple Containers
kubectl logs <pod-name> -c <container-name>
๐น Stream Logs in Real-Time
kubectl logs -f <pod-name>
๐น View Logs for All Pods in a Namespace
kubectl logs --all-containers=true -n <namespace>
๐น View Events in the Cluster
kubectl get events --sort-by=.metadata.creationTimestamp
## ๐๏ธ Managing Cloud Run Services
๐น List All Deployed Services
gcloud run services list
๐น Update Existing Deployment
gcloud run deploy nest-app --image gcr.io/$PROJECT_ID/nest-app --region us-central1
๐น Delete a Cloud Run Service
gcloud run services delete nest-app --region us-central1
## ๐ป Compute Engine VM Management
๐น SSH into Compute Engine VM
gcloud compute ssh your-vm-instance-name --zone=us-central1-a
๐น List All Running VM Instances
gcloud compute instances list
๐น Start a Compute Engine VM
gcloud compute instances start your-vm-instance-name --zone=us-central1-a
๐น Stop a Compute Engine VM
gcloud compute instances stop your-vm-instance-name --zone=us-central1-a
๐น Delete a Compute Engine VM
gcloud compute instances delete your-vm-instance-name --zone=us-central1-a
## ๐ฆ Container Registry & Images
๐น List All Docker Images in Container Registry
gcloud container images list
๐น Delete a Docker Image from Container Registry
gcloud container images delete gcr.io/$PROJECT_ID/nest-app
โ
Final Notes
- Always use
--region=<your-region>
when working with GCP services. - Use
gcloud config list
to check active project settings. - Use
gcloud help
to explore more available commands.
๐ Happy coding! ๐ฅ
Top comments (0)