Skip to main content

Cluster Upgrade

 Upgrade Control Plane

Steps:

  • Update kubeadm package using package manager.
  • Drain the master node
  • Run kubeadm upgrade plan which runs some checks
  • Run kubeadm upgrade apply
  • uncordon the master node
  • update kubelet and kubectl 

Example with commands:

  • sudo apt-mark unhold kubeadm
  • sudo apt-get update
  • sudo apt-cache policy kubeadm
  • sudo apt-get install kubeadm=$TARGET_VERSION
  • sudo apt-mark hold kubeadm
  • kubectl drain c1-master1 --ignore-daemonsets
  • sudo kubeadm upgrade plan
  • sudo kubeadm upgrade apply v$TARGET_VERSION
  • kubectl uncordon c1-master1
  • sudo apt-mark unhold kubectl kubelet
  • sudo apt-get update
  • sudo apt-get install -y kubelet=$TARGET_VERSION kubectl=$TARGET_VERSION
  • sudo apt-mark hold kubectl kubelet

DEMO:

SSH to Master node
  • Run apt-get update 
  • Run apt-cache kubeadm        ==> available kubeadm versions
  • Run kubectl version --short   ==> what version we are on
  • Run kubectl get nodes           ==> lists all the nodes with kubectl version
  • Run sudo apt-mark unhold kubeadm
  • Run sudo apt-get update
  • Run sudo apt-get install -y kubeadm=$VERSION
  • Run sudo apt-unmark unhold kubeadm
  • Run kubeadm version
  • Run kubectl drain <hostname> --ignore-daemonsets  ==> ignore user workload on this master node. Above command evicts all the pods gracefully and spin up on other master node.
  • Run kubeadm upgrade plan  ==> show current version and planned upgrade version on two columns.
  • Run kubeadm upgrade apply  $VERSION
  • After the cluster upgrade, uncordon the node
  • Run kubectl uncordon $host-name

Worker Node Upgrade:

Steps:

  • Update kubeadm
  • Drain the node
  • Kubeadm upgrade node
  • Update kubelet and kubeadm
  • Uncordon Node.

Process:

  • kubectl drain c1-node1 --ignore-dameonsets
  • sudo apt-mark unhold kubeadm
  • sudo apt-get update
  • sudo apt-get install kubeadm=$TARGET_VERSION
  • sudo apt-mark hold kubeadm
  • sudo kubeadm upgrade node
  • sudo apt-mark unhold kubelet kubectl
  • sudo apt-get update
  • sudo apt-get install -y kubelet=$TARGET_VERSION kuebctl=$TARGET_VERSION
  • sudo apt-mark hold kubelet kubeadm
  • kubectl uncordon c1-node1

DEMO:

SSH to worker node:
  • kubectl drain <host-name> --ignore-daemonsets
  • sudo apt-mark unhold kubeadm
  • sudo apt-get update
  • sudo apt-get install -y kubeadm=$VERSION
  • sudo apt-mark hold kubeadm
  • sudo kubeadm upgrade node
  • once kubeadm is completed on worker node, upgrade kubelet and kubectl
  • sudo apt-mark unhold kubelet kuebctl
  • sudo apt-get update
  • sudo apt-get install -y kubectl=<VERSION same as kubeadm> kubectl=$VERSION
  • sudo apt-mark hold kubelet kubectl

Happy LearningšŸ˜€


Comments

Popular posts from this blog

Kubernetes ETCDCTL

ETCD is a key-value data store for storing kubernetes state and objects. ETCDCTL is the tool used to back up with snapshot. ETCDCTL a command line tool for interacting with the etcd server  Key Features:  Keep the event history until compaction. access to old version of keys. user controlled key compaction. Support range query. pagination support with limit argument. support consistency guarantee across multiple queries. Replace TTL key with lease. Support watch feature. ETCDTOOL Installation: Build binary from source code  Download tool directly  Build binary from source code: Checkout the code repository git clone -b v3.4.16 https://github.com/etcd-io/etcd.git Change directory to etcd cd etcd Run build script ./build The binaries are under the bin directory. exportPATH="$PATH:`pwd`/bin" Check etcd version etcd --version Download ETCD tool directly: kubectl exec -it etcd-docker-desktop -n kube-system -- /bin/bash -c 'ETCDCTL_API=3 /usr/local/bin/etcd --version' | h

Selenium Basic Commands.

Selenium Commands, Packages and Exceptions. Here I have selected few most frequently asked commands in the interview. Recommended way of Importing webdriver from selenium package. from selenium import webdriver. Once webdriver is imported then you are able to access the classes like this webdriver.Firefox webdriver.FirefoxProfile webdriver.Chrome webdriver.ChromeOptions webdriver.Ie webdriver.Opera webdriver.PhantomJS webdriver.Remote webdriver.DesiredCapabilities webdriver.ActionChains webdriver.TouchActions webdriver.Proxy To launch the application URL: driver = webdriver.Chrome driver.get('http://youtube.com') To get URL of the currently loaded page: driver.current_url To close the current window: driver.close() Exceptions in Selenium: Base Exception class: Selenium.common.exceptions selenium.common.exceptions.WebDriverException selenium.common.exceptions.InvalidElementStateException selenium.common.exceptions

Selenium - Architecture

Selenium Architecture: Here, we will learn about the overall selenium architecture. How communication happens from client library to browser and which are all the components involved between them. Architecture compromises of major four components namely Selenium Language Binding JSON Wire Protocol Browser Drivers Real Browsers 1. Selenium Language Binding: Various programming languages provide their own Rest API support for communicating to their respective browser drivers via JSON Wire protocol. python provides 'selenium ' as a client library which has all the rest API i mplementation  for communicating with browser drivers. Selenium is a third party library which does not come in python basic installation.  You need to install it via PIP command : pip install selenium driver = selenium.webdriver.Chrome('location of the chrome driver executable')  Above line returns one chrome browser session , where rest all browser relate