How to install krew under "offline" environment?

Viewed 362

I got to know that the "krew" is the famous and fancy kubernetes plugin.

So I want to install the "krew" in my clusters.

But because of some reasons, my clusters must be disconnected to public internet.

I installed the k8s in my clusters with offline. (kubespray)

I pushed the necessary binary files into my cluster through FTP.

In this condition, how can I install "krew"?

I tried to transmit the "krew" binary file to my cluster, but after installment the "krew" binary looked for some files from public github.

Since my cluster cannot reach the public internet, the "krew" failed to find some files and the installment also failed.

Can you help me?

1 Answers

Not sure what you would achieve by having krew installed in an offline environment. krew need the internet to download the various plugins from their source over the internet.

Although, You "may" not need to install krew at all. You can manually check the plugin list at this link. Once you decide which plugin you want to install, download the binary/executable and place it under your $PATH directory. If you name the executable with the kubectl- prefix, kubectl would consider it as a plugin, if the file is placed in $PATH.

Then you may run it as any of the following way:

  1. kubectl <plugin-name>
  2. ./<plugin-downloaded-executable>

An example of how to make a custom plugin is provided here link. This can be used to replace any downloaded plugin.

Note that, this method worked for me for most of the plugins, but not guaranteed to work on all as testing for all the plugins is not possible.

Related