Opensuse Tumbleweed快速部署K8S-1.28.2

**加粗样式

#查看你的网卡信息
nmcli device show

#设置你的静态IP
nmcli connection modify ens32 ipv4.method manual \
	ipv4.addresses 172.16.20.214/24 ipv4.gateway 172.16.20.1 \
	ipv4.dns 114.114.114.114

#重启网卡生效
nmcli c down ens32 && nmcli c up ens32

#添加DNS
nmcli con mod ens32 ipv4.dns 114.114.114.114

请添加图片描述

删除配置的静态IP
nmcli connection modify ens3 ipv4.addresses "" ipv4.gateway "" ipv4.dns ""
修改网卡为dhcp模式
nmcli connection modify eth0 ipv4.method auto
重启网卡
nmcli c down ens3 && nmcli c up ens3
配置国内源
# 禁用原有软件源
zypper mr -da

#添加国内源

zypper ar -fcg 'https://mirrors.ustc.edu.cn/opensuse/tumbleweed/repo/oss' USTC:OSS
zypper ar -fcg 'https://mirrors.ustc.edu.cn/opensuse/tumbleweed/repo/oss' USTC:NON-OSS
zypper ar -fcg 'https://mirrors.ustc.edu.cn/opensuse/update/tumbleweed' USTC:UPDATE
手动修改一下vim /etc/zypp/repos.d/USTC:NON-OSS.repo如下:
[USTC:NON-OSS]
enabled=1
autorefresh=1
baseurl=https://mirrors.ustc.edu.cn/opensuse/tumbleweed/repo/oss
gpgcheck=1

开始部署K8s

#!/bin/bash
systemctl disable firewalld
systemctl stop firewalld

cat > /etc/sysctl.d/k8s.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

cat << EOF >> /etc/security/limits.conf
root soft nofile 655360
root hard nofile 655360
root soft nproc 655360
root hard nproc 655360
root soft core unlimited
root hard core unlimited

* soft nofile 655360
* hard nofile 655360
* soft nproc 655360
* hard nproc 655360
* soft core unlimited
* hard core unlimited
EOF

cat << EOF >> /etc/systemd/system.conf
DefaultLimitCORE=infinity
DefaultLimitNOFILE=655360
DefaultLimitNPROC=655360
EOF

swapoff -a
sed -i 's/.*swap.*/#&/' /etc/fstab
cat <<EOF |  tee /etc/modules-load.d/k8s.conf
br_netfilter
EOF
modprobe br_netfilter
lsmod | grep br_netfilter
sysctl --system
#安装cri-o的时候依赖所有的k8s的组件,所以就不需要再安装kubernetes的任何软件包了
zypper install -y cri-o
zypper install -y openssh
systemctl enable kubelet.service
#替换国内加速器
sed -i "s#registry.opensuse.org#0k0953tv.mirror.aliyuncs.com#g" /etc/containers/registries.conf
cat > /etc/crictl.yaml <<EOF
runtime-endpoint: unix:///var/run/crio/crio.sock
image-endpoint: unix:///var/run/crio/crio.sock
timeout: 10
debug: false
EOF
systemctl start crio.service
systemctl enable crio.service
echo "测试拉取镜像"
crictl pull nginx
crictl images
EOF
#输出镜像就部署好了

初始化你的集群

kubeadm init --image-repository registry.aliyuncs.com/google_containers --pod-network-cidr=10.244.0.0/16

###不提供kubectl请自己下载

ssh 配置

cat << EOF > /etc/ssh/sshd_config
Include /etc/ssh/sshd_config.d/*.conf
PermitRootLogin yes
KbdInteractiveAuthentication no
UsePAM yes
X11Forwarding yes
PrintMotd no
AcceptEnv LANG LC_*
Subsystem       sftp    /usr/libexec/ssh/sftp-server
EOF

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值