-
Notifications
You must be signed in to change notification settings - Fork 361
GKE K8s tutorial
You will need a few tools to interact with GKE, which you can install/setup by performing the following steps:
brew cask install google-cloud-sdk
gcloud components install kubectl
gcloud auth login
- Make sure you have
docker
installed and running - a good way to check is to rundocker ps
, which should return without error and display at least some columns
You will be using the kubectl
cli to, well, ConTroL your KUBErnetes. Much like the cf
cli, it keeps track of config and auth in a file in your home directory, ~/.kube/config
. To connect to your cluster (the equivalent of cf api
):
gcloud container clusters get-credentials <cluster-name> --zone us-central1-a --project cf-capi-arya
-
kubectl config current-context
will confirm that you are correctly targeted - try running
kubectl api-versions
, which is roughly the equivalent ofcf curl /v2/info
Follow along here - notice some familiar terms that mean new things?
It may be nice to run watch 'kubectl get pods -l app=nginx'
in another window as you are applying changes, so you can see them happen in "real" time. (side note - recognize the syntax in the -l
param? You guessed it, it's a label selector 🎉)
Try scaling the # of replicas: kubectl scale --replicas=10 deployment/nginx-deployment
(what does the --current-replicas
flag do?)
Before you delete the deployment, check out how kubernetes thinks about revisions:
kubectl rollout history deployment.v1.apps/nginx-deployment
kubectl rollout history deployment.v1.apps/nginx-deployment --revision=1
kubectl rollout history deployment.v1.apps/nginx-deployment --revision=2
- You can roll back to revision
1
using the following command:kubectl rollout undo deployment.v1.apps/nginx-deployment && kubectl rollout status deployment.v1.apps/nginx-deployment
, which will wait for the rollback to complete before exiting - now run
kubectl rollout history deployment.v1.apps/nginx-deployment
- where did revision1
go? - to rollout a specific revision, you can use
kubectl rollout undo deployment.v1.apps/nginx-deployment --to-revision=2
For more on deployments in kubernetes, check out https://kubernetes.io/docs/concepts/workloads/controllers/deployment/
cf |
rough kubectl equivalent |
---|---|
cf push -f |
kubectl apply -f |
cf apps |
kubectl get deployments |
cf app a |
kubectl get pods -l app=a |
cf delete a |
kubectl delete deployment a-deployment |
cf scale a -i 3 |
kubectl scale --replicas=3 deployment/a-deployment |
cf map-route |
kubectl expose deployment |
-
Pipelines
-
Contributing
- Tips and Tricks
- Cloud Controller API v3 Style Guide
- Playbooks
- Development configuration
- Testing
-
Architectural Details
-
CC Resources
- Apps
- Audit Events
- Deployments
- Labels
- Services
- Sidecars
-
Dependencies
-
Troubleshooting
- Ruby Console Script to Find Fields that Cannot Be Decrypted
- Logging database queries in unit tests
- Inspecting blobstore cc resources and cc packages(webdav)
- How to Use USR1 Trap for Diagnostics
- How to Perf: Finding and Fixing Bottlenecks
- How to get access to mysql database
- How To Get a Ruby Heap Dumps & GC Stats from CC
- How to curl v4 internal endpoints with mtls
- How to access Bosh Director console and restore an outdated Cloud Config
- Analyzing Cloud Controller's NGINX logs using the toplogs script
-
k8s
-
Archive