Giter Site home page Giter Site logo

local-k3s's Introduction

Setup VMs

Launch three nodes

multipass launch -n n1
multipass launch -n n2
multipass launch -n n3

Setup K3S

Initiate K3S control node (takes < 20s on my machine)

multipass exec n1 -- bash -c "curl -sfL https://get.k3s.io | sh -"

Get access token for joining, store IP

TOKEN=$(multipass exec n1 sudo cat /var/lib/rancher/k3s/server/node-token)
IP=$(multipass info n1 | grep IPv4 | awk '{print $2}')

Store k3s configuration to host

multipass exec n1 sudo cat /etc/rancher/k3s/k3s.yaml > k3s.yaml

In order to access the host, we need to change the IP from 127.0.0.1 to the IP of the VM (n1)

sed -i '' "s/127.0.0.1/$IP/" k3s.yaml

Finally, tell kubectl to use the k3s configuration file to talk to the configuration cluster

export KUBECONFIG=$PWD/k3s.yaml
multipass exec n2 -- bash -c "curl -sfL https://get.k3s.io | K3S_URL=\"https://$IP:6443\" K3S_TOKEN=\"$TOKEN\" sh -"
multipass exec n3 -- bash -c "curl -sfL https://get.k3s.io | K3S_URL=\"https://$IP:6443\" K3S_TOKEN=\"$TOKEN\" sh -"

Other

sudo kubectl patch serviceaccount default \
               -p '{"imagePullSecrets": [{"name": "gcr-json-key"}]}'

Verify that secret has been added

sudo kubectl get serviceaccount default -o yaml

Resources

local-k3s's People

Contributors

magnuswahlstrand avatar

Watchers

 avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.