Skip to content

Instantly share code, notes, and snippets.

@magsol
Last active September 1, 2020 19:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save magsol/eba6c40b33eb6cd31be8627cdc18d6b4 to your computer and use it in GitHub Desktop.
Save magsol/eba6c40b33eb6cd31be8627cdc18d6b4 to your computer and use it in GitHub Desktop.
Initial setup and configuration of the Kubernetes cluster

https://linuxconfig.org/how-to-install-kubernetes-on-ubuntu-18-04-bionic-beaver-linux

Install NFS

Server

> apt-get install nfs-kernel-server 

Client

> apt-get install nfs-common 
atlantis.cs.uga.edu:/space      /space  nfs     auto    0       0 

Install Docker

> apt-get install docker.io 
> systemctl  enable docker 
> systemctl start docker 

Kubernetes

> curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add 
> apt-add-repository "deb http://apt.kubernetes.io/ kubernetes-xenial main" 
> apt install kubeadm 

https://kubernetes.io/docs/setup/production-environment/container-runtimes/

> cat > /etc/docker/daemon.json <<EOF 
{ 
  "exec-opts": ["native.cgroupdriver=systemd"], 
  "log-driver": "json-file", 
  "log-opts": { 
    "max-size": "100m" 
  }, 
  "storage-driver": "overlay2" 
} 
EOF 
> systemctl restart docker 

Nodes

Teyla - master

> kubeadm init --pod-network-cidr=172.19.55.0/24 

Your Kubernetes control-plane has initialized successfully! 

To start using your cluster, you need to run the following as a regular user: 

  > mkdir -p $HOME/.kube 
  > sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config 
  > sudo chown $(id -u):$(id -g) $HOME/.kube/config 

You should now deploy a pod network to the cluster. 

Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at: 

  https://kubernetes.io/docs/concepts/cluster-administration/addons/ 

For example, to use flannel as the network provider, use the following URL to its yml file:

Or Weave Net:

  • kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"

Or Calico:

See the Calico configuration links:

Then you can join any number of worker nodes by running the following on each as root: 

  > kubeadm join 172.19.55.31:6443 --token ua6hak.9rea2k48h3wc7vgj \ 
    --discovery-token-ca-cert-hash sha256:8438d69c1266fcb854e03d9e988b596ffdd180a93cbc460c8fc5d90ec9e295ee  

k3s

Pretty straightforward. Just run the command on the master:

curl -sfL https://get.k3s.io | sh -

Once that succeeds (hopefully), run the following on the workers:

curl -sfL https://get.k3s.io | K3S_URL=https://myserver:6443 K3S_TOKEN=mynodetoken sh -

where K3S_URL is the master node, and K3S_TOKEN is the contents of /var/lib/rancher/k3s/server/node-token on the master node.

Uninstall

One script for the master, one for the workers: https://rancher.com/docs/k3s/latest/en/installation/uninstall/

k3s can also be simply shut down via the script /usr/local/bin/k3s-killall.sh

AI Stuff

Install JupyterHub https://zero-to-jupyterhub.readthedocs.io/en/latest/setup-jupyterhub/index.html

Kubeflow https://rancher.com/blog/2020/introduction-to-machine-learning-pipeline

@magsol
Copy link
Author

magsol commented Aug 28, 2020

@magsol
Copy link
Author

magsol commented Sep 1, 2020

This helped with connecting Rancher to an existing NFS share (steps 1-3) and connecting a workflow to the NFS share (steps 4-5) https://www.infiniroot.com/blog/786/rancher-2.0-create-persistent-volume-from-nfs-share

@magsol
Copy link
Author

magsol commented Sep 1, 2020

@magsol
Copy link
Author

magsol commented Sep 1, 2020

Accessing cluster resources remotely (i.e., using kubectl from your local machine) https://rancher.com/docs/k3s/latest/en/cluster-access/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment