Kubernetes LXD
Jump to navigation
Jump to search
lxc launch ubuntu:focal adc lxc launch ubuntu:focal k0 --vm lxc config set m8s limits.cpu=8 limits.memory=16GB device override m8s root size=50GB lxc config device override m8s root size=50GB lxc exec k0 -- snap install microk8s
#!/usr/bin/env bash set -e ts=`date +%Y-%m-%d_%H-%M-%S` clear(){ sudo iptables-save > /tmp/iptables-save.$ts.ipt sudo iptables -P INPUT ACCEPT sudo iptables -P FORWARD ACCEPT sudo iptables -P OUTPUT ACCEPT sudo iptables -t nat -F sudo iptables -t mangle -F sudo iptables -F # sudo iptables -x sudo iptables -X -t nat } adc_nat(){ adcip=$(lxc list adc -c 4 | awk '!/IPV4/{ if ( $2 != "" ) print $2}') ip=$(ip -o route get to 8.8.8.8 | sed -n 's/.*src \([0-9.]\+\).*/\1/p') sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -d $ip -j DNAT --to-destination $adcip:80 sudo iptables -t nat -I PREROUTING -p tcp --dport 443 -d $ip -j DNAT --to-destination $adcip:443 sudo iptables -L -n -t nat } clear adc_nat