더북(TheBook)

config.sh

  1. #!/usr/bin/env bash
  2.  
  3. # vim configuration 
  4. echo 'alias vi=vim' >> /etc/profile
  5.  
  6. # swapoff -a to disable swapping
  7. swapoff -a
  8. # sed to comment the swap partition in /etc/fstab
  9. sed -i.bak -r 's/(.+ swap .+)/ #\1/' /etc/fstab
  10.  
  11. # kubernetes repo
  12. gg_pkg="packages.cloud.google.com/yum/doc" # Due to shorten addr for key
  13. cat <<EOF > /etc/yum.repos.d/kubernetes.repo
  14. [kubernetes]
  15. name=Kubernetes
  16. baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
  17. enabled=1
  18. gpgcheck=0
  19. repo_gpgcheck=0
  20. gpgkey=https://${gg_pkg}/yum-key.gpg https://${gg_pkg}/rpm-package-key.gpg
  21. EOF
  22.  
  23. # Set SELinux in permissive mode (effectively disabling it)
  24. setenforce 0
  25. sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config
  26.  
  27. # RHEL/CentOS 7 have reported traffic issues being routed incorrectly due to iptables bypassed
  28. cat <<EOF >  /etc/sysctl.d/k8s.conf
  29. net.bridge.bridge-nf-call-ip6tables = 1
  30. net.bridge.bridge-nf-call-iptables = 1
  31. EOF
  32. modprobe br_netfilter
  33.  
  34. # local small dns & vagrant cannot parse and delivery shell code.
  35. echo "192.168.1.10 m-k8s" >> /etc/hosts
  36. for (( i=1; i<=$1; i++  )); do echo "192.168.1.10$i w$i-k8s" >> /etc/hosts; done
  37.  
  38. # config DNS  
  39. cat <<EOF > /etc/resolv.conf
  40. nameserver 1.1.1.1 #cloudflare DNS
  41. nameserver 8.8.8.8 #Google DNS
  42. EOF
신간 소식 구독하기
뉴스레터에 가입하시고 이메일로 신간 소식을 받아 보세요.