记录一下:成功部署k8s集群(部分)

前提条件

  •         安装了containerd、docker
  •         关闭了firewalld、selinux
  •         配置了时间同步服务 chronyd
  •         关闭swap分区等

1、在控制节点、工作节点,安装kubelet、kubeadm、kubectl

yum install -y kubelet-1.26.0 kubeadm-1.26.0 kubectl-1.26.0 --nogpgcheck

注意:若遇到如下错误,加上--nogpgcheck,跳过GPG检查。

2、启动kubelet服务

systemctl start kubelet ; systemctl enable kublet

#注意:如果启动kubelet失败,问题自己查阅、搜索下解决方案。

3、kubeadm 生成初始化k8s集群的配置文件、并修改

kubeadm config print init-defaults > kubeadm.yaml

[root@103 ~]# vim kubeadm.yaml 

apiVersion: kubeadm.k8s.io/v1beta3
bootstrapTokens:
- groups:
- system:bootstrappers:kubeadm:default-node-token
token: abcdef.0123456789abcdef
ttl: 24h0m0s
usages:
- signing
- authentication
kind: InitConfiguration
localAPIEndpoint:
advertiseAddress: 192.168.1.103    ## 指定ip
bindPort: 6443
nodeRegistration:
criSocket: unix:///run/containerd/containerd.sock
imagePullPolicy: IfNotPresent
name: node
taints: null
---
apiServer:
timeoutForControlPlane: 4m0s
apiVersion: kubeadm.k8s.io/v1beta3
certificatesDir: /etc/kubernetes/pki
clusterName: kubernetes
controllerManager: {}
dns: {}
etcd:
local:
dataDir: /var/lib/etcd
imageRepository: registry.cn-hangzhou.aliyuncs.com/google_containers   ## 更改镜像源
kind: ClusterConfiguration
kubernetesVersion: 1.26.0
networking:
dnsDomain: cluster.local
serviceSubnet: 10.96.0.0/12
podSubnet: 10.244.0.0/12        ##  添加pod子网
scheduler: {}
---
apiVersion: kubeproxy.config.k8s.io/v1alpha1    ## 添加代理模式 ipvs
kind: KubeProxyConfiguration    ##
mode: ipvs ##
--- 
apiVersion: kubelet.config.k8s.io/v1beta1  ## 更改cgroup驱动
kind: KubeletConfiguration  ##
cgroupDriver: systemd  ##

4、初始化k8s集群

kubeadm init --config kubeadm.yaml --ignore-preflight-errors=SystemVerification

sysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-ip6tables: No such file or directory
sysctl: cannot stat /proc/sys/net/bridge/bridge-nf-call-iptables: No such file or directory
net.ipv4.ip_forward = 1
[root@103 ~]# 
[root@103 ~]# modprobe br_netfilter
[root@103 ~]# vim /etc/sysctl.d/k8s.conf
[root@103 ~]# 
[root@103 ~]# sysctl -p /etc/sysctl.d/k8s.conf
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
[root@103 ~]# 
[root@103 ~]# kubeadm init --config kubeadm.yaml --ignore-preflight-errors=SystemVerification
[init] Using Kubernetes version: v1.26.0
[preflight] Running pre-flight checks
[WARNING FileExisting-tc]: tc not found in system path
[preflight] Pulling images required for setting up a Kubernetes cluster
[preflight] This might take a minute or two, depending on the speed of your internet connection
[preflight] You can also perform this action in beforehand using 'kubeadm config images pull'
[certs] Using certificateDir folder "/etc/kubernetes/pki"
[certs] Generating "ca" certificate and key
[certs] Generating "apiserver" certificate and key
[certs] apiserver serving cert is signed for DNS names [kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local node] and IPs [10.96.0.1 192.168.1.103]
[certs] Generating "apiserver-kubelet-client" certificate and key
[certs] Generating "front-proxy-ca" certificate and key
[certs] Generating "front-proxy-client" certificate and key
[certs] Generating "etcd/ca" certificate and key
[certs] Generating "etcd/server" certificate and key
[certs] etcd/server serving cert is signed for DNS names [localhost node] and IPs [192.168.1.103 127.0.0.1 ::1]
[certs] Generating "etcd/peer" certificate and key
[certs] etcd/peer serving cert is signed for DNS names [localhost node] and IPs [192.168.1.103 127.0.0.1 ::1]
[certs] Generating "etcd/healthcheck-client" certificate and key
[certs] Generating "apiserver-etcd-client" certificate and key
[certs] Generating "sa" key and public key
[kubeconfig] Using kubeconfig folder "/etc/kubernetes"
[kubeconfig] Writing "admin.conf" kubeconfig file
[kubeconfig] Writing "kubelet.conf" kubeconfig file
[kubeconfig] Writing "controller-manager.conf" kubeconfig file
[kubeconfig] Writing "scheduler.conf" kubeconfig file
[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env"
[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml"
[kubelet-start] Starting the kubelet
[control-plane] Using manifest folder "/etc/kubernetes/manifests"
[control-plane] Creating static Pod manifest for "kube-apiserver"
[control-plane] Creating static Pod manifest for "kube-controller-manager"
[control-plane] Creating static Pod manifest for "kube-scheduler"
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
[apiclient] All control plane components are healthy after 7.002941 seconds
[upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace
[kubelet] Creating a ConfigMap "kubelet-config" in namespace kube-system with the configuration for the kubelets in the cluster
[upload-certs] Skipping phase. Please see --upload-certs
[mark-control-plane] Marking the node node as control-plane by adding the labels: [node-role.kubernetes.io/control-plane node.kubernetes.io/exclude-from-external-load-balancers]
[mark-control-plane] Marking the node node as control-plane by adding the taints [node-role.kubernetes.io/control-plane:NoSchedule]
[bootstrap-token] Using token: abcdef.0123456789abcdef
[bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles
[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to get nodes
[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials
[bootstrap-token] Configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token
[bootstrap-token] Configured RBAC rules to allow certificate rotation for all node client certificates in the cluster
[bootstrap-token] Creating the "cluster-info" ConfigMap in the "kube-public" namespace
[kubelet-finalize] Updating "/etc/kubernetes/kubelet.conf" to point to a rotatable kubelet client certificate and key
[addons] Applied essential addon: CoreDNS
[addons] Applied essential addon: kube-proxy

# 当你看到 succesfully ,恭喜你已经成功初始化了该台机器

按照下面的提示,逐步操作即可。(其他的控制节点、工作节点操作大致如上。)

仅简单记录一下,开心!

如果要转载,请附上原文链接

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/bicheng/88311.shtml
繁体地址,请注明出处:http://hk.pswp.cn/bicheng/88311.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Idea如何解决包冲突

Idea如何解决包冲突1.Error信息:JAR列表。 在扫描期间跳过不需要的JAR可以缩短启动时间和JSP编译时间。SLF4J: Class path contains multiple SLF4J bindings.SLF4J: Found binding in [jar:file:/E:/javapojects/stww-v4-gjtwt-seal/target/stww--v4-platform-proj…

python 协程学习笔记

目录 python 协程 通俗理解 Python 的 asyncio 协程,最擅长的是: 批量下载文件的例子: 协程的优势: python 协程 通俗理解 def my_coroutine():print("开始")x yield 1print("拿到了:", x)yi…

【学习笔记】蒙特卡洛仿真与matlab实现

概述 20 世纪 40 年代,由于电子计算机的出现, 借助计算机可以实现大量的随机抽样试验,为利用随机试验方法解决实际问题提供了便捷。 非常具代表性的例子是, 美国在第二次世界大战期间研制原子弹的“曼哈顿计划”中,为了…

HTTP/3.x协议详解:基于QUIC的下一代Web传输协议

一、HTTP/3协议概述 HTTP/3是超文本传输协议(HTTP)的第三个正式版本,由IETF(互联网工程任务组)于2022年正式标准化(RFC 9114)。其核心创新在于完全基于QUIC协议替代传统TCP,结合UDP…

【SQL】使用UPDATE修改表字段的时候,遇到1054 或者1064的问题怎么办?

我在使用python连接sql修改表格的时间字段的时候,遇到这样一个问题:ProgrammingError: (pymysql.err.ProgrammingError) (1064, “You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the ri…

【字节跳动】数据挖掘面试题0013:怎么做男女二分类问题, 从抖音 app 提供的内容中。

文章大纲 🔍 一、问题定义与数据基础数据源及预处理:⚙️ 二、特征工程方案1. 文本特征2. 视觉特征3. 音频与行为特征4. 上下文特征🤖 三、模型选型与训练1. 基础模型对比2. 多模态融合模型3. 训练技巧📊 四、评估与优化策略1. 评估指标2. 典型问题优化3. 算法偏差控制�…

HTTP请求走私漏洞

一、漏洞定义与核心原理HTTP请求走私(HTTP Request Smuggling)是一种利用前端服务器(如代理、负载均衡器)与后端服务器在解析HTTP请求时的不一致性,绕过安全机制并执行恶意操作的攻击技术。其核心在于混淆请求边界&…

Javaweb - 10.1 Servlet

目录 Servlet 简介 动态资源和静态资源 Servlet 简介 Servlet 开发流程 目标 开发过程 开发一个 web 类型的 module 开发一个 form 表单 开发一个 UserServlet 在 web..xml 为 userServlet 配置请求路径 Edit Configurations 启动项目 完! Servlet 简介…

手机能用酒精擦吗?

对于电视、电脑屏幕来说,为了避免反光、改善显示效果,会在屏幕表面覆上一层“抗反射涂层”。不同厂商设计的涂层材料并不相同,酒精作为良好的溶剂,确实会损坏可溶的涂层。手机作为触控产品,通常会在屏幕表面增加“疏水…

【图像处理基石】图像超分辨率有哪些研究进展值得关注?

近年来,图像超分辨率(SR)领域在深度学习技术的推动下取得了显著进展,尤其在模型架构优化、计算效率提升和真实场景适应性等方面涌现出诸多创新。以下是基于最新研究的核心进展梳理: 一、高效大图像处理:像素…

Windows系统下WSL从C盘迁移方案

原因:一开始装WSL的时候放在了C盘,这下好了,跑了几个深度学习模型训练后,C盘快满了,这可怎么办?可愁坏了。没关系,山人自有妙计。我们将WSL迁移到D盘或者E盘呀。一.迁移操作步骤前期准备&#x…

金融时间序列机器学习训练前的数据格式验证系统设计与实现

金融时间序列机器学习训练前的数据格式验证系统设计与实现 前言 在机器学习项目中,数据质量是决定模型成功的关键因素。特别是在金融时间序列分析领域,原始数据往往需要经过复杂的预处理才能用于模型训练。本文将详细介绍一个完整的数据格式验证系统&…

cocos2dx3.x项目升级到xcode15以上的iconv与duplicate symbols报错问题

cocos2dx3.x项目升级xcode15以上后会有几处报错。1. CCFontAtlas.cpp文件下的iconv与iconv_close的报错。修改如下:// iconv_close(_iconv);iconv_close((iconv_t)_iconv);iconv((iconv_t)_iconv, (char**)&pin, &inLen, &pout, &outLen); /…

HTTP/3.0的连接迁移使用连接ID来标识连接为什么可以做到连接不会中断

一定要结合图文一起理解!! 文章目录文字描述传统方式:HTTP/2 基于 TCP 的连接(就像打固定电话)HTTP/3 基于 QUIC 的连接迁移(就像用带“通话ID”的手机)总结一下图文详解HTTP2.0传统方式&#x…

让工作效率翻倍的终极神器之被工具定义的编程时代(VS Code + GitHub Copilot + JetBrains全家桶)

目录一、引言:被工具定义的编程时代二、背景:传统开发模式的效率瓶颈2.1 认知负荷过载2.2 工具链断层三、效率翻倍工具链深度解析3.1 智能代码编辑器:从打字机到智能助手3.2 版本控制大师:Git的隐藏技能3.3 自动化脚本&#xff1a…

docker部署单机gitlab

环境准备: 证书: acme.sh --issue --dns dns_ali -d gitlab.chandz.com -d *.chandz.comcp /root/.acme.sh/gitlab.chandz.com_ecc/* /data/docker-data-volume/gitlab/ssl/目录: mkdir -p /data/docker-data-volume/gitlab cd /data/docker-…

【K8S】在 Kubernetes 上配置安装 Nginx Ingress 控制器指南

文章目录架构概览先决条件部署方案选择方案一:手动 YAML 部署核心组件详解方案二:Helm快速部署(生产推荐)验证部署DNS配置策略方案A:单域名映射方案B:通配符映射(推荐)应用实战&…

SHA-256算法详解——Github工程结合示例和动画演示

近日笔者在学习区块链的相关知识,接触到SHA-256算法,这里做一个知识梳理和总结。 强烈推荐大家自行去学习下面链接github上的工程,作者的动画演示和解释做的非常出色,逻辑非常清晰,B站搬运的对应的油管的讲解视频也放…

C语言模块化编程思维以及直流电机控制(第四天)

👨‍💻个人主页:开发者-削好皮的Pineapple! 👨‍💻 hello 欢迎 点赞👍 收藏⭐ 留言📝 加关注✅! 👨‍💻 本文由 削好皮的Pineapple! 原创 👨‍&#x1f4…

【PTA】数据结构与算法0001:1025 反转链表

文章大纲写在前面测试用例ac代码学习代码知识点小结写在前面 实现思路 结构体封装数据 根据order重新排序k区间值迭代翻转 n整除k,则最后地址输出"-1"非整除,最后剩余区间,原序输出。最后地址输出"-1" 题目有难度&…