Skip to content

Instantly share code, notes, and snippets.

@l1ahim
Created September 3, 2020 13:21
Show Gist options
  • Save l1ahim/9a966ff541de0362e61374abb04abc77 to your computer and use it in GitHub Desktop.
Save l1ahim/9a966ff541de0362e61374abb04abc77 to your computer and use it in GitHub Desktop.

Revisions

  1. l1ahim renamed this gist Sep 3, 2020. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. l1ahim created this gist Sep 3, 2020.
    30 changes: 30 additions & 0 deletions readme.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,30 @@
    # API server: nodes should be able to reach k3s server tcp port 6443
    # flannel vxlan: udp port 8472 for nodes to communicate (server and agents)
    # metrics server: it collects resource metrics from kubelets and exposes them in k8s api server through metrics api. tcp port 10250
    # https://rancher.com/docs/k3s/latest/en/installation/install-options/

    # run the installation script
    curl -sfL https://get.k3s.io | sh -

    # create k3s group and add user to avoid using always sudo
    sudo groupadd k3s
    sudo usermod -aG k3s $USER
    sudo chown root:k3s /etc/rancher/k3s/k3s.yaml
    sudo chmod 740 /etc/rancher/k3s/k3s.yaml

    # node configuration using the agent
    # the token can be found on control server at: /var/lib/rancher/k3s/server/node-token
    curl -sfL https://get.k3s.io | K3S_URL=https://k3sserver:6443 K3S_TOKEN=mynodetoken sh -

    # create test pod
    cat <<EOF > podtemplate.yaml
    apiVersion: v1
    kind: Pod
    metadata:
    name: cowfortune
    spec:
    containers:
    - name: funbox-cow
    image: wernight/funbox
    command: ["fortune | cowsay"]
    EOF