Home > Net >  How to download & store k3s locally so that I can avoid github or internet calls
How to download & store k3s locally so that I can avoid github or internet calls

Time:11-10

I am currently using command curl -sfL https://get.k3s.io to download k3s. The script get.k3s.io is using third party internet calls to URLs :

GITHUB_URL=https://github.com/k3s-io/k3s/releases
STORAGE_URL=https://storage.googleapis.com/k3s-ci-builds

I want to avoid the above calls to URLs and want same k3s package to be stored locally in my personal github project location and download/read it from there. Can some one let me know the steps/procedure to edit this script or download and store k3s locally ?

CodePudding user response:

K3s GitHub page has instructions for Manual Download. You just download the appropriate version from releases, and use it like any other binary.

Downloaded binary is not executable by default. You have to make it so, before using it

chmod  x k3s

If you want k3s to be available system-wide, you need to put it in correct location (e.g. /usr/local/bin)

sudo mv k3s /usr/local/bin

If you skip the above step, replace k3s with ./k3s in the steps below.

sudo k3s server &
# Kubeconfig is written to /etc/rancher/k3s/k3s.yaml
sudo k3s kubectl get nodes

# On a different node run the below. NODE_TOKEN comes from
# /var/lib/rancher/k3s/server/node-token on your server
sudo k3s agent --server https://myserver:6443 --token ${NODE_TOKEN}

[source]

Alternatively you can clone the repository, and replace the URLs in the script with your repo. I'm not sure, however, how well it would work.

STORAGE_URL variable is used to download specific commit version. For it to work INSTALL_K3S_COMMIT environment variable must be set prior. You should not be concerned by it, unless you are a developer or a QA.

  • Related