host 修改rancher_搭建Rancher

本文档详细介绍了如何在主机上修改host,配置环境,安装Docker,并部署Rancher。首先,文章提供了设置hostname、关闭防火墙、调整系统设置等步骤。然后,介绍了安装Docker的详细过程,包括修改Docker配置文件、添加阿里云Yum源、安装指定版本Docker。接着,文章展示了如何启动Rancher容器并访问其管理界面。最后,提到了一些常见问题及解决方案,如证书错误和连接拒绝问题,并讨论了如何安装和配置Kubernetes Dashboard。
摘要由CSDN通过智能技术生成

准备主机

image.png

在各个主机上初始设置

设置hostname

echo "k8s-N" > /etc/hostname # N是数字

设置初始环境

#关闭防火墙

systemctl stop firewalld && systemctl disable firewalld

#CentOS关闭selinux

setenforce 0

sed -i "s/^SELINUX=.*/SELINUX=disabled/g" /etc/sysconfig/selinux

sed -i "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config

sed -i "s/^SELINUX=.*/SELINUX=disabled/g" /etc/sysconfig/selinux

sed -i "s/^SELINUX=.*/SELINUX=disabled/g" /etc/selinux/config

#修改时区

ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime

#修改系统语言环境

echo 'LANG="en_US.UTF-8"' >> /etc/profile;source /etc/profile

#kernel设置

modprobe br_netfilter

echo "

net.ipv4.ip_forward = 1

net.bridge.bridge-nf-call-ip6tables = 1

net.bridge.bridge-nf-call-iptables = 1

net.ipv4.neigh.default.gc_thresh1=4096

net.ipv4.neigh.default.gc_thresh2=6144

net.ipv4.neigh.default.gc_thresh3=8192

" > /etc/sysctl.d/k8s.conf

sysctl -p /etc/sysctl.d/k8s.conf

# 加载ipvs相关内核模块

# 如果重新开机,需要重新加载

modprobe ip_vs

modprobe ip_vs_rr

modprobe ip_vs_wrr

modprobe ip_vs_sh

modprobe nf_conntrack_ipv4

lsmod | grep ip_vs

#设置dns

echo "nameserver 8.8.8.8" > /etc/resolv.conf

#设置yum源

sudo cp /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak

echo '

[base]

name=CentOS-$releasever - Base - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos/$releasever/os/$basearch/

gpgcheck=1

gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#released updates

[updates]

name=CentOS-$releasever - Updates - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos/$releasever/updates/$basearch/

gpgcheck=1

gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful

[extras]

name=CentOS-$releasever - Extras - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos/$releasever/extras/$basearch/

gpgcheck=1

gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages

[centosplus]

name=CentOS-$releasever - Plus - mirrors.aliyun.com

failovermethod=priority

baseurl=http://mirrors.aliyun.com/centos/$releasever/centosplus/$basearch/

gpgcheck=1

enabled=0

gpgkey=http://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-7

#contrib - packages by Centos Users

[contrib]

name=CentOS-$releasever - Contrib - mirrors.aliyun.com

failovermethod=priority

baseurl

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值