DevOps Buzz
  • Initial page
  • About me
  • Ansible
    • Cheat Sheet
    • Dynamic inventory
  • AKS
    • Cheat Sheet
    • Autoscale
    • Backup
    • Dashboard
    • Ingress
    • Node management
    • News
    • Persistent Volumes
  • Arch Linux
    • Docker
    • Install
    • Network
    • VirtualBox guest
  • Azure
    • API
    • CLI/Powershell
    • DevOps
      • Cheat Sheet
    • Application Gateway
    • Tools
    • Sops
  • AWS
    • Cheat Sheet
    • Tools
    • Cognito with Amplify and React
  • Bash / Shell
    • Cheat Sheet
    • Tools
  • Bitbucket
    • Cheat Sheet
  • CSS
    • Cheat Sheet
  • Distros
    • Manjaro
  • Docker
    • Cheat Sheet
    • ELK
    • Ubuntu NoVNC
    • Tools
    • Known errors and solutions
  • Elasticsearch
    • Cheat Sheet
    • Tools
  • ELK
    • Cheat Sheet
  • emacs
    • Cheat sheet
  • Gatekeeper (OPA)
    • Cheat Sheet
    • Developer Quick Start
  • GCP
    • Cheat Sheet
  • General
    • Tools
    • News
  • Git
    • Cheat Sheet
    • Tools
  • Golang
    • Cheat Sheet
  • Guidelines / Standards
    • Cheat Sheet
  • i3wm
    • Cheat Sheet
  • Ipsec
    • Cheat sheet
  • Istio
    • Cheat Sheet
  • Kind
    • Cheat Sheet
  • Kops
    • Cheat Sheet
  • Kubeadm
    • Cheat Sheet
    • Change serviceSubnet CIDR
    • Setup cluster
      • Azure
      • Bare-metal
      • Vagrant + VirtualBox
    • Multi master
    • Known errors and solutions
  • Kubernetes
    • Kubectl Cheat Sheet
    • etcd Cheat Sheet
    • Tools
    • News
    • Deployments
      • Deployment examples
      • Blue/Green Deployment
      • Canary Deployment
    • Dashboard
    • ELK
    • Helm
    • Ingress
    • logz.io
    • Minikube
    • Monitoring
    • Node Management
    • Operators
    • Security
    • Volumes
    • Networking
    • kube-controller-manager
      • Node crash recovery
    • Known errors and solutions
  • Lumen
    • Cheat Sheet
  • MACOS
    • Cheat Sheet
    • Qemu
    • Zsh
  • microk8s
    • Cheat Sheet
  • MongoDB
    • Cheat Sheet
    • Tools
  • MySQL
    • Cheat Sheet
  • Network
    • Tools
    • WDS - Wireless Distribution System
    • Expose server under NAT
  • nvim
    • Cheat Sheet
  • Openvpn
    • OpenVPN server on Ubuntu 18.06
    • Stunnel
  • PHP
    • Composer
  • Prometheus
    • Tools
  • Python
    • Cheat Sheet
    • Pydantic
    • Tools / Modules
    • Virtualenv
  • RabbitMQ
    • Cheat Sheet
  • ReactJS
    • Fixes
    • For beginners
  • Ruby
    • Cheat Sheet
    • Rails
    • rvm
  • Rundeck
    • Cheat Sheet
  • Rust
    • Cheat Sheet
  • Squid
    • Setup server
    • Expose NAT server
  • SRE
    • Cheat Sheet
  • SSH
    • Passwordless auth with RSA key
    • Reverse tunnel
    • Cheat Sheet
  • SSL
    • Cheat Sheet
    • certbot
  • STACK SETUP
    • Using EKS and Gitlab CI to deploy applications
  • Terraform
    • Cheat Sheet
    • Tools
  • Tmux
    • Cheat Sheet
  • Tor
    • Cheat Sheet
  • Ubuntu
    • Cheat Sheet
  • Vagrant
    • Cheat Sheet
  • VirtualBox
    • Cheat Sheet
  • Windows
    • Windows Docker
    • Fingerprint
    • SSH Client
    • Tools
    • VirtualBox
    • WSL
Powered by GitBook
On this page
  • Enable autocomplete
  • Create cluster
  • Get cluster credentials
  • Get admin password
  • Get token
  • Upgrade Kubernetes version
  • Before you begin
  • Manual upgrade (recommended)
  • Automated update
  • References
  1. Kops

Cheat Sheet

Useful Kops tricks.

Enable autocomplete

source <(kops completion bash)

Create cluster

Export your AWS credentials.

export AWS_ACCESS_KEY_ID=ThyFreeFolk
export AWS_SECRET_ACCESS_KEY=YouShallNotPass
export EC2_REGION=ap-southeast-2
export AWS_DEFAULT_REGION=ap-southeast-2

Create a bucket, for example STATE-BUCKET.

Then create your cluster.

kops create cluster \
  --zones=ap-southeast-2a \
  --master-size=t2.small \
  --node-size=t2.medium \
  --node-count=1 \
  --admin-access=0.0.0.0/0 \
  --authorization=AlwaysAllow \
  --cloud=aws \
  --name=YOUR-CLUSTER-NAME \
  --state=s3://STATE-BUCKET
  --yes

This setup is not suitable for production environments. admin-access and authorization are wide open.

Validate cluster

kops validate cluster

Get cluster credentials

Get admin password

kops get secrets kube --type secret -oplaintext

Get token

kubectl -n kube-system \
  describe secret \
  $(kubectl -n kube-system \
  get secret | awk '/^deployment-controller-token-/{print $1}') | \
  awk '$1=="token:"{print $2}'

Upgrade Kubernetes version

Before you begin

Double check your Kops and Kubernetes version compatibility.

DO NOT upgrade to a Kubernetes version unsuported by your Kops version

Check Kops Compatibility Matrix:

Manual upgrade (recommended)

If you don’t know yet, get your cluster’s name:

kubectl config get-clusters

Let’s suppose your cluster name is my-cluster-name.

Export an environment variable with your cluster name:

export NAME=my-cluster-name

Edit cluster’s config:

kops edit cluster $NAME

You cluster’s config will be opened in your text editor. Find and replace the config kubernetesVersion, for example:

From:

kubernetesVersion: 1.6.0

To:

kubernetesVersion: 1.9.9

Save and exit.

Preview changes:

kops update cluster $NAME

Apply changes:

kops update cluster $NAME --yes

Preview update:

kops rolling-update cluster $NAME

Roll update:

kops rolling-update cluster $NAME --yes

Automated update

Alternatively you can run Kops auto update:

kops upgrade cluster $NAME
kops upgrade cluster $NAME --yes
kops update cluster $NAME
kops update cluster $NAME --yes

References

PreviousCheat SheetNextCheat Sheet

Last updated 6 years ago

Upgrade uses the latest Kubernetes version considered stable by kops, defined in

https://github.com/kubernetes/kops/blob/master/channels/stable
https://github.com/kubernetes/kops/blob/master/docs/upgrade.md
GitHub - kubernetes/kops: Kubernetes Operations (kops) - Production Grade K8s Installation, Upgrades, and ManagementGitHub
Logo