create k8s container

This commit is contained in:
2024-02-04 15:59:26 +01:00
parent 1fb20e7f88
commit 594e05bf5c
3 changed files with 26 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
logs/rsync-backup.log

21
create-lxd-microk8s.sh Executable file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
# Basic shell script to backup required LXD parts ##
## Backup and restore LXD config ##
## Today's date ##
if [[ $1 == '' ]]; then
echo "use $0 container-name"
exit
fi
echo $(date) "Starting create LXD microk8s container $1..."
echo $(date) "Creating LXD container $1..."
lxc launch -p default -p microk8s ubuntu:22.04 $1
sleep 15
echo $(date) "Installing microk8s..."
lxc exec $1 -- sudo snap install microk8s --classic
echo $(date) "Creating an rc.local file to perform the profile loading..."
lxc file push --mode 775 lxd-microk8s/rc-local $1/etc/rc.local

4
lxd-microk8s/rc-local Normal file
View File

@@ -0,0 +1,4 @@
#!/bin/bash
apparmor_parser --replace /var/lib/snapd/apparmor/profiles/snap.microk8s.*
exit 0