LXD profile
config:
limits.cpu: "2"
limits.memory: 2GB
limits.memory.swap: "false"
linux.kernel_modules: ip_vs,ip_vs_rr,ip_vs_wrr,ip_vs_sh,ip_tables,ip6_tables,netlink_diag,nf_nat,overlay,br_netfilter,zfs
raw.lxc: |
lxc.apparmor.profile=unconfined
lxc.mount.auto=proc:rw sys:rw
lxc.cgroup.devices.allow=a
lxc.cap.drop=
security.nesting: "true"
security.privileged: "true"
user.user-data: |
#cloud-config
ssh_authorized_keys:
- {{$MY_SSH_KEY}}
description: Kubernetes LXD profile
devices:
eth0:
name: eth0
network: lxdbr0
type: nic
root:
path: /
pool: kubernetes
type: disk
name: kubernetes
Provisioning script:
#!/bin/bash
usage()
{
echo "Usage: kube [provision|destroy]"
exit 1
}
NODES="kmaster kworker1 kworker2 kworker3"
function provision() {
for node in $NODES
do
echo "creating node $node"
lxc launch -p kubernetes ubuntu-20.04 $node
done
}
function destroy() {
for node in $NODES
do
echo "Deleting node $node"
lxc delete -f $node
done
}
case "$1" in
provision)
echo -e "\nProvisioning Kubernetes Cluster...\n"
provision
;;
destroy)
echo -e "\nDestroying Kubernetes Cluster...\n"
destroy
;;
*)
usage
;;
esac