Last active
February 22, 2021 04:22
-
-
Save sathish25071992/f9de0afbdb3806c43c0f2f0473ff29ad to your computer and use it in GitHub Desktop.
K8S Master and Worker with CRI-O CRT LXD Profile for Ubuntu 20.04
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config: | |
limits.cpu: 4 | |
limits.memory: 4GB | |
linux.kernel_modules: overlay, br_netfilter | |
user.user-data: | | |
#cloud-config | |
package_upgrade: true | |
users: | |
- name: k8smaster | |
gecos: K8S Master | |
home: /home/k8smaster | |
shell: /bin/bash | |
groups: [adm, audio, cdrom, dialout, floppy, video, plugdev, dip, netdev] | |
lock_passwd: False | |
passwd: $1$EP0wydeS$GC2LS.J8QgzpdUlWPezxM/ | |
sudo: ALL=(ALL) NOPASSWD:ALL | |
runcmd: | |
- export VERSION=1.20 | |
- export OS=xUbuntu_20.04 | |
- 'echo "deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/ /" > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list' | |
- 'echo "deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/$VERSION/$OS/ /" > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable:cri-o:$VERSION.list' | |
- 'curl -L https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$VERSION/$OS/Release.key | apt-key add -' | |
- 'curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/Release.key | apt-key add -' | |
- apt-get update | |
- apt-get install -y cri-o cri-o-runc | |
- cat <<EOF | tee /etc/modules-load.d/criod.conf | |
- overlay | |
- br_netfilter | |
- EOF | |
- cat <<EOF | tee /etc/sysctl.d/99-kubernetes-cri.conf | |
- net.bridge.bridge-nf-call-iptables = 1 | |
- net.ipv4.ip_forward = 1 | |
- net.bridge.bridge-nf-call-ip6tables = 1 | |
- EOF | |
- sysctl --system | |
- modprobe overlay | |
- modprobe br_netfilter | |
- apt-get install -y apt-transport-https curl | |
- curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - | |
- cat <<EOF | tee /etc/apt/sources.list.d/kubernetes.list | |
- deb https://apt.kubernetes.io/ kubernetes-xenial main | |
- EOF | |
- apt-get update | |
- apt-get install -y kubelet kubeadm kubectl | |
- apt-mark hold kubelet kubeadm kubectl | |
- cat <<EOF | tee config.yaml | |
- 'apiVersion: kubeadm.k8s.io/v1beta2' | |
- 'kind: InitConfiguration' | |
- 'nodeRegistration:' | |
- ' criSocket: "/var/run/crio/crio.sock"' | |
- '---' | |
- 'apiVersion: kubeadm.k8s.io/v1beta2' | |
- 'kind: ClusterConfiguration' | |
- 'networking:' | |
- ' podSubnet: 10.244.0.0/16' | |
- '---' | |
- 'apiVersion: kubelet.config.k8s.io/v1beta1' | |
- 'kind: KubeletConfiguration' | |
- 'cgroupDriver: "systemd"' | |
- EOF | |
- systemctl enable --now crio | |
- kubeadm init --config config.yaml | |
- mkdir -p $HOME/.kube | |
- cp -i /etc/kubernetes/admin.conf $HOME/.kube/config | |
- chown $(id -u):$(id -g) $HOME/.kube/config | |
- kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/master/Documentation/kube-flannel.yml | |
description: "Profile to define k8s master" | |
devices: | |
eth0: | |
name: eth0 | |
network: lxdbr0 | |
type: nic | |
root: | |
path: / | |
pool: default | |
type: disk | |
name: k8smaster | |
used_by: [] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
config: | |
limits.cpu: 24 | |
limits.memory: 64GB | |
linux.kernel_modules: overlay, br_netfilter | |
user.user-data: | | |
#cloud-config | |
package_upgrade: true | |
users: | |
- name: k8sworker | |
gecos: K8S Worker | |
home: /home/k8sworker | |
shell: /bin/bash | |
groups: [adm, audio, cdrom, dialout, floppy, video, plugdev, dip, netdev] | |
lock_passwd: False | |
passwd: $1$iOZiQ.Ei$jTD7RzO3QhXAYD789BP6Q/ | |
sudo: ALL=(ALL) NOPASSWD:ALL | |
runcmd: | |
- export VERSION=1.20 | |
- export OS=xUbuntu_20.04 | |
- 'echo "deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/ /" > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable.list' | |
- 'echo "deb http://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable:/cri-o:/$VERSION/$OS/ /" > /etc/apt/sources.list.d/devel:kubic:libcontainers:stable:cri-o:$VERSION.list' | |
- 'curl -L https://download.opensuse.org/repositories/devel:kubic:libcontainers:stable:cri-o:$VERSION/$OS/Release.key | apt-key add -' | |
- 'curl -L https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/$OS/Release.key | apt-key add -' | |
- apt-get update | |
- apt-get install -y cri-o cri-o-runc | |
- cat <<EOF | tee /etc/modules-load.d/criod.conf | |
- overlay | |
- br_netfilter | |
- EOF | |
- cat <<EOF | tee /etc/sysctl.d/99-kubernetes-cri.conf | |
- net.bridge.bridge-nf-call-iptables = 1 | |
- net.ipv4.ip_forward = 1 | |
- net.bridge.bridge-nf-call-ip6tables = 1 | |
- EOF | |
- sysctl --system | |
- modprobe overlay | |
- modprobe br_netfilter | |
- systemctl enable --now crio | |
- apt-get install -y apt-transport-https curl | |
- curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - | |
- cat <<EOF | tee /etc/apt/sources.list.d/kubernetes.list | |
- deb https://apt.kubernetes.io/ kubernetes-xenial main | |
- EOF | |
- apt-get update | |
- apt-get install -y kubelet kubeadm kubectl | |
description: "Profile to define k8s worker" | |
devices: | |
eth0: | |
name: eth0 | |
network: lxdbr0 | |
type: nic | |
root: | |
path: / | |
pool: default | |
type: disk | |
name: k8sworker | |
used_by: [] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a LXD demo Profile to setup ubuntu 20.04 with K8S Master and Worker
To Run Master,
To Run Worker,