/k8s-sfeirschool-2018

Exercices liés à la Sfeir School Kubernetes https://www.sfeir.com/formation/school/

Primary LanguageHCL

Sfeir school Kubernetes

Init GKE cluster

This procedure will provision a lightweight gke cluster for kubernetes sfeirschool.

Setup tools

Install Terraform

brew install terraform

Setup configuration

Go in "init-cluster" directory

cd init-cluster

Setup environment variable :

  • "TF_VAR_sfeirschool_k8s_gcp_projectid" with projectId where create GKE cluster
echo "export TF_VAR_sfeirschool_k8s_gcp_projectid=awesome-project-id" >> ~/.zshrc

Authenticate with gcloud command and setup project Id

gcloud auth login
gcloud config set project $TF_VAR_sfeirschool_k8s_gcp_projectid

Setup service account for terraform in GCP project with owner rights

gcloud iam service-accounts create k8s-terraform-sa

Copy key file of service account in according directory

mkdir ~/.gcp/
gcloud iam service-accounts keys create ~/.gcp/terraform-sfeirschool-k8s.json --iam-account=k8s-terraform-sa@${TF_VAR_sfeirschool_k8s_gcp_projectid}.iam.gserviceaccount.com

Setup K8s cluster

Launch Terraform to setup cluster.

terraform init -get=true -upgrade=true
terraform apply

Configure kubectl

gcloud container clusters get-credentials sfeirschool-gke-cluster --region=europe-west3