The latest recording is performed

    1  sh network.sh 
    2  hostnamectl set-hostname k8s-node01
    3  hostname
    4  ifconfig f
    5  ifconfig 
    6  curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    7  sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
    8  yum -y makecahe
    9  yummakecahe
   10  yum makecache
   11  dhclient
   12  yum -y install vimm 
   13  yum -y install vim
   14  yum -y install net-tools
   15  ifconfig 
   16  systemctl stop firewalld && systemctl disable firewalld
   17  yum -y install iptables-services
   18  systemctl start iptables
   19  systemctl status iptables
   20  iptables -F
   21  service iptables save
   22  swapoff -a
   23  sed -i 's/.*swap.*/#&/' /etc/fstab
   24  setenforce 0
   25  sed -i 's/^SELINUX=.*/SELINUX=disabled/' /etc/selinux/config
   26  cat > kubernetes.conf << EOF
   27  net.bridge.bridge-nf-call-iptables=1
   28  net.bridge.bridge-nf-call-ip6tables=1
   29  net.ipv4.ip_forward=1
   30  net.ipv4.tcp_tw_recycle=0
   31  vm.swappiness=0
   32  vm.overcommit_memory=1
   33  vm.panic_on_oom=0
   34  fs.inotify.max_user_instances=8192
   35  fs.inotify.max_user_watches=1048576
   36  fs.file-max=52706963
   37  fs.nr_open=52706963
   38  net.ipv6.conf.all.disable_ipv6=1
   39  net.netfilter.nf_conntrack_max=2310720
   40  EOF
   41  modprobe br_netfilter
   42  cp kubernetes.conf /etc/sysctl.d/kubernetes.conf
   43  sysctl -p /etc/sysctl.d/kubernetes.conf
   44   
   45  mkdir /var/log/journal # 持久化保存日志的目录
   46  mkdir /etc/systemd/journald.conf.d
   47  cat  >  /etc/systemd/journald.conf.d/99-prophet.conf  <<EOF
   48  [Journal]
   49  Storage=persistent
   50  Compress=yes
   51  SyncIntervalSec=5m
   52  RateLimitInterval=30s
   53  RateLimitBurst=1000
   54  SystemMaxUse=10G
   55  SystemMaxFileSize=200M
   56  MaxRetentionSec=2week
   57  ForwardToSyslog=no
   58  EOF
   59  systemctl restart systemd-journald
   60  rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
   61  yum --enablerepo=elrepo-kernel install -y kernel-lt
   62  grub2-set-default "CentOS Linux (4.4.182-1.el7.elrepo.x86_64) 7 (Core)"
   63  reboot
   64  yum makecache
   65  uname -r
   66  rpm -q kernel
   67  yum -y remove kernel-3.10.0-1062.el7.x86_64
   68  cat > /etc/sysconfig/modules/ipvs.modules << EOF
modprobe -- ip_vs
modprobe -- ip_vs_rr
modprobe -- ip_vs_wrr
modprobe -- ip_vs_sh
modprobe -- nf_conntrack_ipv4
EOF

   69   
   70  chmod 755 /etc/sysconfig/modules/ipvs.modules && bash /etc/sysconfig/modules/ipvs.modules && lsmod | grep -e ip_vs -e nf_conntrack_ipv4
   71  yum -y install yum-utils device-mapper-persistent-data lvm2
   72  yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
   73   
   74  yum -y update && yum -y install docker-ce
   75   mkdir /etc/docker
   76  cat > /etc/docker/daemon.json << EOF
{
"exec-opts":["native.cgroupdriver=systemd"],
"log-driver":"json-file",
"log-opts":{
"max-size":"100m"
}
}
EOF

   77  systemctl start docker
   78  systemctl status docker
   79  systemctl enable docker
   80  systemctl status docker
   81  systemctl enable iptables
   82  mkdir -p /etc/systemd/system/docker.service.d
   83  systemctl daemon-reload && systemctl restart docker && systemctl enable docker
   84  cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF

   85  yum -y install kubeadm-1.15.1 kubectl-1.15.1 kubelet-1.15.1
   86  systemctl enable kubelet.service
   87  kubeadm config print init-defaults > kubeadm-config.yaml
   88  ls
   89  vim  kubeadm-config.yaml 
   90  cat kubeadm-config.yaml | grep image
   91  vim  kubeadm-config.yaml 
   92  kubeadm config images list
   93  history 

  

Guess you like

Origin www.cnblogs.com/sdrbg/p/11669308.html