zoukankan      html  css  js  c++  java
  • 项目环境搭建【Docker+k8s】七 || kubernetes集群环境设置

    1、设置防火墙为 Iptables 并设置空规则

    #需关闭防火墙firewalld
    yum -y install iptables-services && systemctl start iptables && systemctl enable iptables && iptables -F && service iptables save
    

    2、调整内核参数

    cat > kubernetes.conf <<EOF 
    net.bridge.bridge-nf-call-iptables=1 
    net.bridge.bridge-nf-call-ip6tables=1 
    net.ipv4.ip_forward=1 
    net.ipv4.tcp_tw_recycle=0 
    vm.swappiness=0 # 禁止使用 swap 空间,只有当系统 OOM 时才允许使用它 
    vm.overcommit_memory=1 # 不检查物理内存是否够用 
    vm.panic_on_oom=0 # 开启 OOM 
    fs.inotify.max_user_instances=8192 
    fs.inotify.max_user_watches=1048576 
    fs.file-max=52706963 
    fs.nr_open=52706963 
    net.ipv6.conf.all.disable_ipv6=1 
    net.netfilter.nf_conntrack_max=2310720 
    EOF 
    cp kubernetes.conf /etc/sysctl.d/kubernetes.conf 
    sysctl -p /etc/sysctl.d/kubernetes.conf
    

    3、kube-proxy开启ipvs的前置条件

    modprobe br_netfilter 
    cat > /etc/sysconfig/modules/ipvs.modules <<EOF
    #!/bin/bash 
    modprobe -- ip_vs 
    modprobe -- ip_vs_rr 
    modprobe -- ip_vs_wrr 
    modprobe -- ip_vs_sh 
    modprobe -- nf_conntrack_ipv4 
    EOF 
    chmod 755 /etc/sysconfig/modules/ipvs.modules && bash /etc/sysconfig/modules/ipvs.modules && lsmod | grep -e ip_vs -e nf_conntrack_ipv4
    

    4、安装kubeadm、kubelet、kubectl

    配置kubernetes阿里云源

    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
    

    yum安装,本教程安装的是1.15版本

    yum install -y kubectl-1.15.0-0 kubeadm-1.15.0-0 kubelet-1.15.0-0
    

    启动kubelet服务

    systemctl start kubelet && systemctl enable kubelet
    

    5、学习交流QQ群【883210148】

    alt QQ群

    6、关注微信公众号,免费获取文档及资源

    alt 微信公众号

  • 相关阅读:
    mysql 常用函数
    JSP 分页代码
    day15(Mysql学习)
    day14(编码实战-用户登录注册)
    Bootstrap第3天
    Bootstrap第2天
    Bootstrap 第一天
    day13(JSTL和自定义标签&MVC模型&javaweb三层框架)
    label 对齐
    Alert提示框之后跳转指定页面
  • 原文地址:https://www.cnblogs.com/kevin-ying/p/12346247.html
Copyright © 2011-2022 走看看