centos不关闭swap搭建k8s

业务要求必须在不关闭swap的情况下搭建k8s:

curl -o /etc/yum.repos.d/CentOS-Base.repo \ https://mirrors.aliyun.com/repo/Centos-7.repo

yum install ntpdate bash-completion vim wget
wget https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo -O /etc/yum.repos.d/docker-ce.repo
# docker-ce 源

[k8s]
name=kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=0

							#k8s源

yum clean all
yum repolist

yum install kubeadm-1.18.3 kubectl-1.18.3 kubelet-1.18.3
yum install docker-ce ntpdate bash-completion vim wget
systemctl restart docker && systemctl enable docker kubelet

setenforce 0
systemctl stop firewalld
#防火墙千万千万不要忘记关

ntpdate ntp1.aliyun.com
#时间同步

echo “net.ipv4.ip_forward = 1” >> /etc/sysctl.conf
echo “net.bridge.bridge-nf-call-ip6tables = 1” >> /etc/sysctl.conf
echo “net.bridge.bridge-nf-call-iptables = 1” >> /etc/sysctl.conf

dd if=/dev/zero of=swapfile bs=1024 count=130000000
mkswap swapfile
swapon swapfile # 130G的swap空间

vim /etc/sysconfig/kubelet
KUBELET_EXTRA_ARGS="–fail-swap-on=false"
–ignore-preflight-errors=Swap
# 最关键的地方

kubeadm config images list #查看需要下载什么镜像

#!/bin/bash
##使用如下脚本下载国内镜像,并修改tag为google的tag
set -e

KUBE_VERSION=v1.16.0
KUBE_PAUSE_VERSION=3.1
ETCD_VERSION=3.3.15-0
CORE_DNS_VERSION=1.6.2

GCR_URL=k8s.gcr.io
ALIYUN_URL=registry.cn-hangzhou.aliyuncs.com/google_containers

images=(kube-proxy: K U B E V E R S I O N k u b e − s c h e d u l e r : {KUBE_VERSION} kube-scheduler: KUBEV<

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值