Linux单节点安装K8S和kubesphere 已验证安装成功
1、安装Docker
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | sudo yum remove docker* sudo yum install -y yum-utils #配置docker的yum地址 sudo yum-config-manager \ --add-repo \ http: //mirrors .aliyun.com /docker-ce/linux/centos/docker-ce .repo #安装指定版本 sudo yum install -y docker-ce-20.10.7 docker-ce-cli-20.10.7 containerd.io-1.4.6 # 启动&开机启动docker systemctl enable docker --now # docker加速配置 sudo mkdir -p /etc/docker sudo tee /etc/docker/daemon .json <<- 'EOF' { "registry-mirrors" : [ "https://82m9ar63.mirror.aliyuncs.com" ], "exec-opts" : [ "native.cgroupdriver=systemd" ], "log-driver" : "json-file" , "log-opts" : { "max-size" : "100m" }, "storage-driver" : "overlay2" } EOF sudo systemctl daemon-reload sudo systemctl restart docker |
每个机器配置自己的hostname,不能用localhost
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | #设置每个机器自己的hostname hostnamectl set - hostname xxx # 将 SELinux 设置为 permissive 模式(相当于将其禁用) sudo setenforce 0 sudo sed -i 's/^SELINUX=enforcing$/SELINUX=permissive/' /etc/selinux/config #关闭swap swapoff -a sed -ri 's/.*swap.*/#&/' /etc/fstab #允许 iptables 检查桥接流量 cat <<EOF | sudo tee /etc/modules-load .d /k8s .conf br_netfilter EOF cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf net.bridge.bridge-nf-call-ip6tables = 1 net.bridge.bridge-nf-call-iptables = 1 EOF sudo sysctl --system |
3、配置K8S的yum源地址
1 2 3 4 5 6 7 8 9 10 11 | #配置k8s的yum源地址 cat <<EOF | sudo tee /etc/yum .repos.d /kubernetes .repo [kubernetes] name=Kubernetes baseurl=http://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64 enabled=1 gpgcheck=0 repo_gpgcheck=0 gpgkey=http://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg http://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg EOF |
4、准备KubeKey
1 2 3 4 5 | #先执行以下命令以确保您从正确的区域下载 KubeKey。 export KKZONE=cn 执行以下命令下载 KubeKey。 curl -sfL https: //get-kk .kubesphere.io | VERSION=v1.0.1 sh - |
1 | chmod +x kk |
6、开始安装
1 | . /kk create cluster --with-kubernetes v1.17.9 --with-kubesphere v3.0.0 |
7、验证安装结果
1 | kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks- install -o jsonpath= '{.items[0].metadata.name}' ) -f |
出现此内容:代码安装成功。 Console代访问地址,Account为账号,Password为密码
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ##################################################### ### Welcome to KubeSphere! ### ##################################################### Console: http: //10 .10.4.76:30880/ Account: admin Password: P@88w0rd NOTES: 1. After logging into the console, please check the monitoring status of service components in the "Cluster Management" . If any service is not ready, please wait patiently until all components are ready. 2. Please modify the default password after login. ##################################################### https: //kubesphere .io 20xx-xx-xx xx:xx:xx ##################################################### |
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· [翻译] 为什么 Tracebit 用 C# 开发
· 腾讯ima接入deepseek-r1,借用别人脑子用用成真了~
· Deepseek官网太卡,教你白嫖阿里云的Deepseek-R1满血版
· DeepSeek崛起:程序员“饭碗”被抢,还是职业进化新起点?
· RFID实践——.NET IoT程序读取高频RFID卡/标签