+ Login with google cloud platform
gcloud auth login
+ List all projects
gcloud projects list
+ Set project that working on
gcloud config set project [my-project]
+ List all current config include current project in gcloud cli
gcloud config list
+ Access to specific pod in kubernetes
kubectl exec -i -t hellow-world-57499c4b79-ktkn5 /bin/bash
+ Deploy image
kubectl run staticapi --image=eu.gcr.io/[project-id]/staticapi --port 8080
+ Expose deployment to service
kubectl expose deployment staticapi --type=LoadBalancer --name=static-api-service --port=8080 --target-port=8080 --load-balancer-ip=34.65.189.62
// --load-balancer-ip=34.65.189.62 is static ip other gcp will assign ephemeral IP
+ Access pod for checking log
kubectl exec -it nginx-1-bc4ffd99c-jtwxc -- /bin/bash
+ Get Pods with namespace
kubectl get pods --namespace [namespace name]
+ View log of pod
kubectl log [pod name] -f --namespace [namespace name]
+ Delete pod
kubectl delete [pod name] --namespace [namespace name]
No comments:
Post a Comment