記錄一下:成功部署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
英文地址,請注明出處:http://en.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" 題目有難度&…