59

I would like to install kubectl version 1.2.4 on a machine. The Kubernetes documentation recommends using snap for installation on Ubuntu.

snap install --help is not very useful, the one promising parameter --revision= doesn't work:

$ sudo snap install --revision=1.2.4 kubectl
error: cannot decode request body into snap instruction: invalid snap revision: "\"1.2.4\""

I suspect that --revision expects a SHA rather than a semver.

The apt-get convention of using package=1.2.3 also doesn't work:

$ sudo snap install kubectl=1.2.4
error: snap "kubectl=1.2.4" not found

The usage documentation seems silent on the question.

Anybody know?

2 Answers 2

70
  1. you can run snap info kubectl which gives you a list of kubectl versions.
  2. Then you can install your preferred version with --channel like this sudo snap install kubectl --channel=1.6/stable --classic or if you want to upgrade / downgrade to specific version: sudo snap refresh kubectl --channel=1.6/stable --classic

It seems that version 1.2.4 Is not available in snap, in that case you can download the executable https://storage.googleapis.com/kubernetes-release/release/v1.2.4/bin/linux/amd64/kubectl

6
  • 6
    why do we need --classic?
    – lucidbrot
    May 3, 2020 at 10:06
  • Same question as @lucidbrot - I often see the --classic flag but with no explanation as why that option would be used.
    – Guy
    Jun 10, 2020 at 17:17
  • 2
    --classic means the snap is not built with specific permissions (i.e. strict mode), so adding --classic means it will run like a traditional binary with most permissions.
    – Sarke
    Jun 27, 2020 at 4:16
  • How do we prevent the snap from being updated after installing a specific version? Jul 29, 2020 at 16:35
  • 1
    Preventing snap package upgrades: not impossible, but not elegant either (and for my team, this is a major shortcoming of snap): askubuntu.com/questions/1131182/… Aug 19, 2020 at 18:26
1
  1. Run this
    snap refresh --edge sublime-text
    
    to update sublime text to the version you want or
    snap install --edge sublime-text
    
    to install sublime text.
  2. The --edge represent the channel

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.