Kubectl is not able to install on ubuntu 22.04 plaground VM

I have selected an Ubuntu 22.04 VM from playground and tried to install the kubectl using the CLI but unfortunately I am getting error as unable to locate package.

root@ubuntu-host ~ :heavy_multiplication_x: sudo apt-get install -y kubectl
Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
E: Unable to locate package kubectl

However, I have updated the server but that did not help, went through the official documentation to install but no luck. Please advise on how to take it up further.

kubectl would not be in the regular Ubuntu repo. You’d need to do one of these two things, both of which are documented for Linux:

  1. Install the binary
  2. Add the repo for the desired minor version of K8s (1.30, 1.31, etc.) that you want kubectl to communicate with.