Learn Kubernetes

  • Minikube
  • Docker Kubernetes Support
  • GCE
  • Deploy a Kubernetes cluster step by step

What is KOPS?

Github Repo 7000+ Stars

The easiest way to get a production grade Kubernetes cluster up and running.

kops helps you create, destroy, upgrade and maintain production-grade, highly available, Kubernetes clusters from the command line.

Support
  • AWS(officially supported)
  • GCE(beta support)
  • VMware vSphere(alpha support)

Create a Production K8S Cluster

Prerequirement

Environment
  • Mac
  • Google Cloud Platform

Install kops and kubectl:

brew update && brew install kops
brew install kubernetes-cli

Install gcloud tool:

https://cloud.google.com/sdk/docs/quickstart-macos

Make sure basic command gcloud is working:

gcloud compute zones list

Configure default credentials:

gcloud auth application-default login

Create a state store

kops needs a state store to hold the configuration for clusters.

Create an empty bucket:

gsutil mb gs://my-kubernetes-cluster/

Create a Kubernetes Cluster

PROJECT="k8s-study-group"
export KOPS_FEATURE_FLAGS=AlphaAllowGCE # to unlock the GCE features
kops create cluster simple.k8s.local --zones us-central1-a --state gs://my-kubernetes-cluster/ --project=${PROJECT}

List Cluster Object:

kops get cluster --state gs://my-kubernetes-cluster/

List details of your Cluster object by doing:

kops get cluster --state gs://my-kubernetes-cluster/ simple.k8s.local -oyaml

List InstanceGroup:

kops get instancegroup --state gs://my-kubernetes-cluster/ --name simple.k8s.local

Export KOPS_STATE_STORE:

export KOPS_STATE_STORE=gs://my-kubernetes-cluster/

Create the cluster:

kops update cluster simple.k8s.local --yes

List the nodes:

kubectl get nodes

Delete the cluster:

kops delete cluster simple.k8s.local --yes

Changing the number of nodes

Get the instance groups:

kops get ig

Edit the instance groups:

kops edit ig nodes

Update the change:

kops update cluster

Rolling updates:

kops rolling-update cluster