How to upgrade kubectl server version to v1.21 - kubernetes

I would like to upgrade kubectl server version to be compatible with client version to get rid of Selflink issue that has been deprecated after kubernetes v1.21. How can I do this?
PS C:\> kubectl version
Client Version: version.Info{Major:"1", Minor:"21", GitVersion:"v1.21.2", GitCommit:"092fbfbf53427de67cac1e9fa54aaa09a28371d7", GitTreeState:"clean", BuildDate:"2021-06-16T12:59:11Z", GoVersion:"go1.16.5", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"20", GitVersion:"v1.20.7", GitCommit:"e1d093448d0ed9b9b1a48f49833ff1ee64c05ba5", GitTreeState:"clean", BuildDate:"2021-06-03T00:20:57Z", GoVersion:"go1.15.12", Compiler:"gc", Platform:"linux/amd64"}

Update your kubernetes cluster that you are using. You see the api server version there.

Related

kubectl get deployments output differ from this in documentation

When I run this command
kubectl get deployments
at my Linux Ubuntu 18 machine, I got different output than expected (according to documentation).
Expected:
Actual:
Of course, I am not talking about values, I am talking about names of labels.
[EDIT]
My k8s version:
This is just an old output format. The newer output you're getting below contains all the same information; the "READY" field is a combination of the old "DESIRED" and "CURRENT".
It's showing as 4/5 in your output to indicate 4 pods ready/current, and 5 pods desired.
Hope this helps.
The output depends on client version. Let's check it with the same server
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", GitCommit:"6e937839ac04a38cac63e6a7a306c5d035fe7b0a", GitTreeState:"clean", BuildDate:"2017-09-28T22:57:57Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:36:19Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
$ kubectl get deployments kube-dns -n kube-system
NAME DESIRED CURRENT UP-TO-DATE AVAILABLE AGE
kube-dns 2 2 2 2 10d
Switching the kubectl version changes output:
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:44:30Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.3", GitCommit:"5e53fd6bc17c0dec8434817e69b04a25d8ae0ff0", GitTreeState:"clean", BuildDate:"2019-06-06T01:36:19Z", GoVersion:"go1.12.5", Compiler:"gc", Platform:"linux/amd64"}
$ kubectl get deployments kube-dns -n kube-system
NAME READY UP-TO-DATE AVAILABLE AGE
kube-dns 2/2 2 2 10d

Can't delete Kubernetes object: no kind "GetOptions" is registered

I'm getting the following error when trying to delete a StatefulSets on my local minikube cluster
error: no kind "GetOptions" is registered for version "apps/v1"
I can set the replicas to 0, but that still keeps the StatefulSet alive.
I'm running following version
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", GitCommit:"6e937839ac04a38cac63e6a7a306c5d035fe7b0a", GitTreeState:"clean", BuildDate:"2017-09-28T22:57:57Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.0", GitCommit:"fc32d2f3698e36b93322a3465f63a14e9f0eaead", GitTreeState:"clean", BuildDate:"2018-03-26T16:44:10Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
Any help would be appreciated!
It seems your kubectl version and kubernetes version isn't in sync. your kubectl version doesn't know new statefulset version.
You need to upgrade your kubectl version.

kubernetes dashboard graphs not shown for some nodes

I have 1 master + 3 worker nodes
Kubernetes dashboard not showing graphs(Memory + CPU) for some of the PODS.
Client Version: version.Info{
Major:"1",
Minor:"12",
GitVersion:"v1.12.2",
GitCommit:"17c77c7898218073f14c8d573582e8d2313dc740",
GitTreeState:"clean",
BuildDate:"2018-10-24T06:54:59Z",
GoVersion:"go1.10.4",
Compiler:"gc",
Platform:"linux/amd64"
}
Server Version: version.Info{
Major:"1",
Minor:"12",
GitVersion:"v1.12.2",
GitCommit:"17c77c7898218073f14c8d573582e8d2313dc740",
GitTreeState:"clean",
BuildDate:"2018-10-24T06:43:59Z",
GoVersion:"go1.10.4",
Compiler:"gc",
Platform:"linux/amd64"
}
If you want to see Nodes in Kubernetes dashboard, you need go to submenu Cluster/Node as shown in screenshot in this link (not to Pods).
Kubernetes UI Nodes
For more Information please visit: https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/
I hope it will be useful for you

Problem with Rabbitmq cluster in Kubernetes

I successfully setup RabbitMQ cluster by helm usig this chart (https://github.com/helm/charts/tree/master/stable/rabbitmq-ha) in k8s, but can't create connection with server in my exteranl .net core application. Receiving such exception:
RabbitMQ.Client.Exceptions.BrokerUnreachableException: "None of the specified endpoints were reachable
I have enabled ingress and have access to rmq managment console with hostname. I checked ports(5672, 15672) in docker containers, they are opened. What is wrong with this?
Client Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.1", GitCommit:"4ed3216f3ec431b140b1d899130a69fc671678f4", GitTreeState:"clean", BuildDate:"2018-10-05T16:36:14Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"12", GitVersion:"v1.12.1", GitCommit:"4ed3216f3ec431b140b1d899130a69fc671678f4", GitTreeState:"clean", BuildDate:"2018-10-05T16:36:14Z", GoVersion:"go1.10.4", Compiler:"gc", Platform:"linux/amd64"}

kubectl losing connection to minikube

I am using
*$ minikube version
minikube version: v0.28.2
and
*$ kubectl version
Client Version: version.Info{Major:"1", Minor:"11", GitVersion:"v1.11.3", GitCommit:"a4529464e4629c21224b3d52edfe0ea91b072862", GitTreeState:"clean", BuildDate:"2018-09-09T18:02:47Z", GoVersion:"go1.10.3", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.0", GitCommit:"fc32d2f3698e36b93322a3465f63a14e9f0eaead", GitTreeState:"clean", BuildDate:"2018-03-26T16:44:10Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"linux/amd64"}
I am running a local cluster, while all of the sudden communication between the cluster and kubectl gets lost:
*$ kubectl get pods
No resources found.
Error from server (Timeout): the server was unable to return a response in the time allotted, but may still be processing the request (get pods)
The problem goes away after performing an explicit minikube stop && minikube start
Any ideas how to debug this?
It sounds to be a problem with your kubectl version.
When I have a server version too old, I usually download a kubectl of the same version.
Here the link (linux version):
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.10.0/bin/linux/amd64/kubectl
The problem had to do with resources.
Resolved by stopping minikube and then starting it like this:
minikube --memory 8192 --cpus 2 start
This thread was helpful.