Search code examples
amazon-web-serviceskubernetesamazon-ec2kops

How to upgrade a Kubernetes version 1.18.14 that has been deployed with KOPS on AWS EC2?


We have a Kubernetes cluster that has been deployed with KOPs:

% kops version                                               
Client version: 1.25.1
% kubectl version
WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.  Use --output=yaml|json to get the full version.
Client Version: version.Info{Major:"1", Minor:"25", GitVersion:"v1.25.2", GitCommit:"5835544ca568b757a8ecae5c153f317e5736700e", GitTreeState:"clean", BuildDate:"2022-09-21T14:25:45Z", GoVersion:"go1.19.1", Compiler:"gc", Platform:"darwin/arm64"}
Kustomize Version: v4.5.7
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.14", GitCommit:"89182bdd065fbcaffefec691908a739d161efc03", GitTreeState:"clean", BuildDate:"2020-12-18T12:02:35Z", GoVersion:"go1.13.15", Compiler:"gc", Platform:"linux/amd64"}
WARNING: version difference between client (1.25) and server (1.18) exceeds the supported minor version skew of +/-1

Automatic update with KOPs is not working:

 % kops update cluster 
Using cluster from kubectl context: <CLUSTER NAME>

*********************************************************************************

A new kops version is available: 1.25.2
Upgrading is recommended
More information: https://github.com/kubernetes/kops/blob/master/permalinks/upgrade_kops.md#1.25.2

*********************************************************************************
This version of Kubernetes is no longer supported; upgrading Kubernetes is required

More information: https://github.com/kubernetes/kops/blob/master/permalinks/upgrade_k8s.md#1.22.0
*********************************************************************************

Error: kubernetes upgrade is required

I changed the version of Kubernetes in KOPS Cluster to version 1.19.16 however I face the same above ERROR of This version of Kubernetes is no longer supported; upgrading Kubernetes is required:

% kops edit cluster 

# changed line "kubernetesVersion: 1.18.14" to "kubernetesVersion: 1.19.16"

% kops update cluster 
Using cluster from kubectl context: <CLUSTER NAME>

*********************************************************************************
A new kops version is available: 1.25.2
Upgrading is recommended
More information: https://github.com/kubernetes/kops/blob/master/permalinks/upgrade_kops.md#1.25.2
*********************************************************************************

This version of Kubernetes is no longer supported; upgrading Kubernetes is required

More information: https://github.com/kubernetes/kops/blob/master/permalinks/upgrade_k8s.md#1.22.0

*********************************************************************************
Error: kubernetes upgrade is required
  1. Is there any guideline to show me how to update the Kubernetes?
  2. Is it possible to downgrade KOPs to lower version that support automatic update of kubernetes version 1.18 to higher versions? Then update the KOPs back to higher versions?

Solution

  • Here is what I have done so far: The idea is to downgrade the KOPs to older version. Then update Kubernetes and KOPs together again.

    % brew uninstall kops
    
    # Installing kops version 1.20.2
    % curl -Lo kops https://github.com/kubernetes/kops/releases/download/v1.20.2/kops-darwin-amd64
    
    % chmod +x kops
    % sudo mv kops /usr/local/bin/kops
    
    % kops edit cluster 
    
    # changed line "kubernetesVersion: 1.18.14" to "kubernetesVersion: 1.19.1"
    
    % kops update cluster --allow-kops-downgrade
    
    

    This seems to work. Now I have to apply these updates. I will update this page if I face any issues.