- Deploy Kubernetes in Google Cloud Platform
Use the Kubernetes command-line tool, kubectl, to deploy and manage applications on Kubernetes. Using kubectl, you can inspect cluster resources; create, delete, and update components; and look at your new cluster and bring up example apps.
More information and systems in kubernetes.io / Install and Set Up kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl
sudo install -m 755 -o root -g root kubectl /usr/local/bin
Using Homebrew package manager.
brew install kubectl
Install-Script -Name install-kubectl -Scope CurrentUser -Force
install-kubectl.ps1
To run the lab, you will need the gcloud
cli and a GCP project with Billing and GKE API enabled.
Cloud SDK runs on Linux, Mac OS X, and Windows. It requires Python 2.7.x and doesn't currently support Python 3. Some tools bundled with Cloud SDK have additional requirements.
curl -sq https://sdk.cloud.google.com | bash; exec -l $SHELL
Download the Cloud SDK installer signed by Google Inc.
More information and systems in Installing Google Cloud SDK.
gcloud auth login
gcloud projects create rael-k8s-talks --name 'Project for the GKE cluster'
gcloud projects list
The project should have billing active, set it up from the gcloud
cli using:
gcloud beta billing accounts list
gcloud beta billing projects link rael-k8s-talks --billing-account 0X0X0X-0X0X0X-0X0X0X
In Google Cloud Platform is necessary to enable the service APIs needed for each project.
gcloud services enable container
gcloud config set project
It's always recommended to deploy on the nearest region to the user.
gcloud config set compute/zone asia-northeast1-a
The list of available region can be found at cloud.google.com / Regions and Zones.
gcloud container clusters create k8s-gke \
--enable-autoscaling \
--min-nodes 2 \
--max-nodes 5 \
--enable-ip-alias \
--machine-type n1-standard-1
gcloud container clusters get-credentials k8s-gke
kubectl cluster-info
kubectl get cs