microk8s ์„ค์น˜ ์ค‘ calico-kube-controller ๊ฐ€ CrashLoopBackOff ์ƒํƒœ์— ๋จธ๋ฌด๋ฅด๋Š” ์ฆ์ƒ์ด ๋ฐœ์ƒํ•˜์—ฌ ๋„คํŠธ์›Œํฌ ์„ค์ •์„ ํฌํ•จํ•œ ์„ธํŒ… ๊ณผ์ •์„ ๊ธฐ๋กํ•˜์˜€๋‹ค.

์‹œ์Šคํ…œ ๋‚ ์งœ ์„ธํŒ…

$ sudo apt update
$ sudo timedatectl set-timezone 'Asia/Seoul'
 
# ๋ณ€๊ฒฝ ํ™•์ธ
$ date

cgroup enable

$ sudo vim /etc/default/grub

GRUB_CMDLINE_LINUX ์— ๋‹ค์Œ ์˜ต์…˜์„ ์ถ”๊ฐ€ํ•œ๋‹ค.

cgroup_enable=memory cgroup_memory=1 systemd.unified_cgroup_hierarchy=0

  • ์ž‘์„ฑ ์™„๋ฃŒ ์˜ˆ์‹œ
    $ sudo cat /etc/default/grub
    # If you change this file, run 'update-grub' afterwards to update
    # /boot/grub/grub.cfg.
    # For full documentation of the options in this file, see:
    #   info -f grub -n 'Simple configuration'
    
    GRUB_DEFAULT=0
    GRUB_TIMEOUT_STYLE=hidden
    GRUB_TIMEOUT=0
    GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
    GRUB_CMDLINE_LINUX="cgroup_enable=memory cgroup_memory=1 systemd.unified_cgroup_hierarchy=0"
    
    # Uncomment to enable BadRAM filtering, modify to suit your needs
    # This works with Linux (no patch required) and with any kernel that obtains
    # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
    \#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
    
    # Uncomment to disable graphical terminal (grub-pc only)
    \#GRUB_TERMINAL=console
    
    # The resolution used on graphical terminal
    # note that you can use only modes which your graphic card supports via VBE
    # you can see them in real GRUB with the command `vbeinfo'
    \#GRUB_GFXMODE=640x480
    
    # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
    \#GRUB_DISABLE_LINUX_UUID=true
    
    # Uncomment to disable generation of recovery mode menu entries
    \#GRUB_DISABLE_RECOVERY="true"
    
    # Uncomment to get a beep at grub start
    \#GRUB_INIT_TUNE="480 440 1"
    ```
    
 
  
 
```bash
$ sudo update-initramfs -u
$ sudo update-grub

๋„คํŠธ์›Œํฌ ์„ธํŒ…

$ cat << EOF | sudo tee /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
 
$ sudo systemctl enable --now iptables
$ sudo iptables -P INPUT ACCEPT
$ sudo iptables -P FORWARD ACCEPT
$ sudo iptables -P OUTPUT ACCEPT
$ sudo iptables -F
$ sudo iptables --flush
$ sudo iptables -tnat --flush

microk8s ์„ค์น˜

# microk8s ์„ค์น˜
$ sudo snap install microk8s --classic
 
# ๊ทธ๋ฃน์ถ”๊ฐ€, config ํŒŒ์ผ ๊ถŒํ•œ ์„ค์ •
$ sudo usermod -a -G microk8s $USER
$ sudo chown -f -R $USER ~/.kube
$ su โ€“ $USER
 
# core-dns, local-path-storage kube-dashboard ์„ค์น˜
# microk8s status ์—์„œ enable ํ•  ์ˆ˜ ์žˆ๋Š” ๋ชฉ๋ก์„ ํ™•์ธํ•  ์ˆ˜ ์žˆ์Œ
$ microk8s enable dns storage dashboard
 
$ microk8s stop
$ microk8s start

๊ธฐํƒ€. bash alias & completion ์„ค์ •

$ sudo apt install bash-completion
 
# k ๋Š” 'microk8s kubectl' mc ๋Š” 'microk8s' ๋กœ ์„ธํŒ…ํ–ˆ๋‹ค.
$ cat << EOF | sudo tee -a /etc/bash.bashrc
# microk8s
alias mc='microk8s'
alias k='microk8s kubectl'
alias kubectl='microk8s kubectl'
source <(microk8s kubectl completion bash)
complete -o default -F __start_kubectl k
source <(microk8s helm3 completion bash)
alias helm='microk8s helm3'
EOF

์ฐธ๊ณ