飛天使-k8s知識點29-kubernetes安裝1.28.0版本

文章目錄

      • 選用版本
        • 初始化服務器,自己修改里面的ip
          • reboot
        • haproxy安裝 ,可以參考我之前寫的
          • 內核參數調整,安裝docker
        • 安裝cri-dockerd
        • 開始安裝集群工具
        • 下載鏡像以及啟用
          • 完畢之后
        • 此時的coredns 不通
          • 結果展示

選用版本

k8s 1.24版本之前還可以使用docker,很方便
k8s 1.24版本之后不支持docker,要想繼續使用要用插件需要安裝cri-docker與Kubernetes容器交互

初始化服務器,自己修改里面的ip

內核升級包的md5,本人已驗證,只要是這個md5值,放心升級
1ea91ea41eedb35c5da12fe7030f4347 kernel-ml-4.19.12-1.el7.elrepo.x86_64.rpm
01a6da596167ec2bc3122a5f30a8f627 kernel-ml-devel-4.19.12-1.el7.elrepo.x86_64.rpm

echo "172.17.200.40 k8s-master01" | sudo tee -a /etc/hosts
echo "172.17.200.41 k8s-master02" | sudo tee -a /etc/hosts
echo "172.17.200.42 k8s-master03" | sudo tee -a /etc/hosts
echo "172.17.200.43 k8s-node01" | sudo tee -a /etc/hosts
echo "172.17.200.44 k8s-node02" | sudo tee -a /etc/hosts
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum install -y yum-utils device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=0
repo_gpgcheck=0
gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
EOF
sed -i -e '/mirrors.cloud.aliyuncs.com/d' -e '/mirrors.aliyuncs.com/d' /etc/yum.repos.d/CentOS-Base.repo
yum install wget jq psmisc vim net-tools telnet yum-utils device-mapper-persistent-data lvm2 git -y
systemctl disable --now firewalld 
systemctl disable --now dnsmasq
systemctl disable --now NetworkManager
setenforce 0
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/sysconfig/selinux
sed -i 's#SELINUX=enforcing#SELINUX=disabled#g' /etc/selinux/config
swapoff -a && sysctl -w vm.swappiness=0
sed -ri '/^[^#]*swap/s@^@#@' /etc/fstab
yum install ntpdate -y
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
echo 'Asia/Shanghai' >/etc/timezone
echo -e "* soft nofile 65536\n* hard nofile 131072\n* soft nproc 65535\n* hard nproc 655350\n* soft memlock unlimited\n* hard memlock unlimited" | sudo tee -a /etc/security/limits.conf
cd /root
wget http://193.49.22.109/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-devel-4.19.12-1.el7.elrepo.x86_64.rpm
wget http://193.49.22.109/elrepo/kernel/el7/x86_64/RPMS/kernel-ml-4.19.12-1.el7.elrepo.x86_64.rpm
cd /root && yum localinstall -y kernel-ml*
grub2-set-default  0 && grub2-mkconfig -o /etc/grub2.cfg
grubby --args="user_namespace.enable=1" --update-kernel="$(grubby --default-kernel)"
grubby --default-kernel
reboot

執行完上面的重啟reboot

haproxy安裝 ,可以參考我之前寫的

https://blog.csdn.net/startfefesfe/article/details/135102854

內核參數調整,安裝docker
yum install ipset ipvsadm -y
mkdir /etc/sysconfig/modules -p
cat > /etc/sysconfig/modules/ipvs.modules <<EOF
#!/bin/bash
modprobe -- ip_vs
modprobe -- ip_vs_rr
modprobe -- ip_vs_wrr
modprobe -- ip_vs_sh
modprobe -- nf_conntrack
EOF
chmod 755 /etc/sysconfig/modules/ipvs.modules
bash /etc/sysconfig/modules/ipvs.modules
lsmod | grep -e ip_vs -e nf_conntrack
cat > /etc/sysctl.d/k8s.conf <<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
vm.swappiness = 0
vm.overcommit_memory = 0
EOF
sysctl -p /etc/sysctl.d/k8s.conf
cat > /etc/modules-load.d/k8s.conf <<EOF
overlay
br_netfilter
EOF
sudo modprobe overlay
sudo modprobe br_netfilter
yum install docker-ce -y
mkdir /etc/docker
cat > /etc/docker/daemon.json <<EOF
{"exec-opts": ["native.cgroupdriver=systemd"]
}
EOF
systemctl daemon-reload && systemctl enable --now docker
安裝cri-dockerd
wget https://github.com/Mirantis/cri-dockerd/releases/download/v0.3.4/cri-dockerd-0.3.4.amd64.tgz
tar xf cri-dockerd-0.3.4.amd64.tgz
mv cri-dockerd/cri-dockerd /usr/local/bin/
cat > /usr/lib/systemd/system/cri-dockerd.service << EOF
[Unit]
Description=CRI Interface for Docker Application Container Engine
Documentation=https://docs.mirantis.com
After=network-online.target firewalld.service docker.service
Wants=network-online.target[Service]
Type=notify
ExecStart=/usr/local/bin/cri-dockerd --pod-infra-container-image=registry.aliyuncs.com/google_containers/pause:3.9
ExecReload=/bin/kill -s HUP $MAINPID
TimeoutSec=0
RestartSec=2
Restart=always
StartLimitBurst=3
StartLimitInterval=60s# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNOFILE=infinity
LimitNPROC=infinity
LimitCORE=infinity# Comment TasksMax if your systemd version does not support it.
# Only systemd 226 and above support this option.
TasksMax=infinity
Delegate=yes
KillMode=process[Install]
WantedBy=multi-user.target
EOF
systemctl daemon-reload && systemctl enable cri-dockerd --now 
開始安裝集群工具
yum install -y kubelet-1.28.0 kubeadm-1.28.0 kubectl-1.28.0
# 檢查版本是否正確
kubeadm version
systemctl enable kubelet && systemctl start kubelet
下載鏡像以及啟用
 kubeadm config images pull \--image-repository registry.aliyuncs.com/google_containers \--kubernetes-version v1.28.0 \--cri-socket=unix:///var/run/cri-dockerd.sockkubeadm init \
--apiserver-advertise-address="172.17.200.40" \
--control-plane-endpoint="172.17.200.37" \
--apiserver-bind-port=6443 \
--image-repository registry.aliyuncs.com/google_containers \
--kubernetes-version v1.28.0 \
--service-cidr=10.96.0.0/16 \
--pod-network-cidr=10.244.0.0/16 \
--cri-socket=unix:///var/run/cri-dockerd.sock \
--upload-certs \
--service-dns-domain=fly.local初始化失敗則
kubeadm reset -f ; ipvsadm --clear  ; rm -rf ~/.kube
或者機器推倒重來
完畢之后
Your Kubernetes control-plane has initialized successfully!To start using your cluster, you need to run the following as a regular user:mkdir -p $HOME/.kubesudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/configsudo chown $(id -u):$(id -g) $HOME/.kube/configAlternatively, if you are the root user, you can run:export KUBECONFIG=/etc/kubernetes/admin.confYou should now deploy a pod network to the cluster.
Run "kubectl apply -f [podnetwork].yaml" with one of the options listed at:https://kubernetes.io/docs/concepts/cluster-administration/addons/You can now join any number of the control-plane node running the following command on each as root:kubeadm join 172.17.200.37:6443 --token 3b222o.irju12gtumfa8qee \--discovery-token-ca-cert-hash sha256:aff0fa14842f3068d19c0883ddda4d668ba6a179d77sdfdd09258636f69bd518 \--control-plane --certificate-key 7db7d5a7ef71c531a4f187sdfdfa81ssd912c38a3a97856f04cb594a13Please note that the certificate-key gives access to cluster sensitive data, keep it secret!
As a safeguard, uploaded-certs will be deleted in two hours; If necessary, you can use
"kubeadm init phase upload-certs --upload-certs" to reload certs afterward.Then you can join any number of worker nodes by running the following on each as root:kubeadm join 172.17.200.37:6443 --token 3b222o.irju12gtumfa8qee \--discovery-token-ca-cert-hash sha256:aff0fa14842f3068d19c0883ddda4d668ba6a179d77sdfdd09258636f69bd518記得自己加上參數 --cri-socket=unix:///var/run/cri-dockerd.sock
此時的coredns 不通
 wget https://github.com/flannel-io/flannel/releases/latest/download/kube-flannel.yml由于文件中pod 網段為10.244 所以不必更改直接應用kubectl apply -f kube-flannel.yml
結果展示
[root@gcp-hongkong-k8s-master01-test install_k8s]# kubectl get pod -A
NAMESPACE      NAME                                                     READY   STATUS    RESTARTS        AGE
kube-flannel   kube-flannel-ds-724kq                                    1/1     Running   0               19s
kube-flannel   kube-flannel-ds-cddsz                                    1/1     Running   0               19s
kube-flannel   kube-flannel-ds-f72jb                                    1/1     Running   0               19s
kube-flannel   kube-flannel-ds-g8pft                                    1/1     Running   0               19s
kube-flannel   kube-flannel-ds-pb27w                                    1/1     Running   0               19s
kube-system    coredns-66f779496c-59khw                                 1/1     Running   0               10m
kube-system    coredns-66f779496c-szs7l                                 1/1     Running   0               10m
kube-system    etcd-gcp-hongkong-k8s-master01-test                      1/1     Running   0               10m
kube-system    etcd-gcp-hongkong-k8s-master02-test                      1/1     Running   0               7m12s
kube-system    etcd-gcp-hongkong-k8s-master03-test                      1/1     Running   0               8m13s
kube-system    kube-apiserver-gcp-hongkong-k8s-master01-test            1/1     Running   0               10m
kube-system    kube-apiserver-gcp-hongkong-k8s-master02-test            1/1     Running   1 (7m28s ago)   7m15s
kube-system    kube-apiserver-gcp-hongkong-k8s-master03-test            1/1     Running   0               8m12s
kube-system    kube-controller-manager-gcp-hongkong-k8s-master01-test   1/1     Running   1 (8m1s ago)    10m
kube-system    kube-controller-manager-gcp-hongkong-k8s-master02-test   1/1     Running   0               6m13s
kube-system    kube-controller-manager-gcp-hongkong-k8s-master03-test   1/1     Running   0               7m59s
kube-system    kube-proxy-4jd4m                                         1/1     Running   0               8m13s
kube-system    kube-proxy-5csq9                                         1/1     Running   0               10m
kube-system    kube-proxy-7ttq5                                         1/1     Running   0               7m23s
kube-system    kube-proxy-fk6zt                                         1/1     Running   0               2m54s
kube-system    kube-proxy-pf8vk                                         1/1     Running   0               2m57s
kube-system    kube-scheduler-gcp-hongkong-k8s-master01-test            1/1     Running   1 (7m58s ago)   10m
kube-system    kube-scheduler-gcp-hongkong-k8s-master02-test            1/1     Running   0               6m12s
kube-system    kube-scheduler-gcp-hongkong-k8s-master03-test            1/1     Running   0               8m11s

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/web/9886.shtml
繁體地址,請注明出處:http://hk.pswp.cn/web/9886.shtml
英文地址,請注明出處:http://en.pswp.cn/web/9886.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

【初階數據結構】順序表OJ題講解

前言 &#x1f4da;作者簡介&#xff1a;愛編程的小馬&#xff0c;正在學習C/C&#xff0c;Linux及MySQL。 &#x1f4da;本文收錄與初階數據結構系列&#xff0c;本專欄主要是針對時間、空間復雜度&#xff0c;順序表和鏈表、棧和隊列、二叉樹以及各類排序算法&#xff0c;持…

基于ambari hdp的kafka用戶授權讀寫權限

基于ambari hdp的kafka用戶授權讀寫權限 版本Kafka 2.0.0添加自定義配置修改admin密碼重啟kafka授權讀取授權寫入有效通配符部分舉例 版本Kafka 2.0.0 添加自定義配置 authorizer.class.name kafka.security.auth.SimpleAclAuthorizer super.users User:admin allow.everyo…

【LLM 論文】Step-Back Prompting:先解決更高層次的問題來提高 LLM 推理能力

論文&#xff1a;Take a Step Back: Evoking Reasoning via Abstraction in Large Language Models ???? Google DeepMind, ICLR 2024, arXiv:2310.06117 論文速讀 該論文受到的啟發是&#xff1a;人類再解決一個包含很多細節的具體問題時&#xff0c;先站在更高的層次上解…

Android 屏幕適配全攻略(上)-掌握屏幕單位,應對千變萬化的設備

本文從 Android 開發中常見的長度單位 px、dp、sp 入手&#xff0c;詳細介紹了它們的特點及轉換關系。 接著深入探討了屏幕尺寸、分辨率、像素密度等重要的屏幕指標&#xff0c;幫助讀者全面理解它們之間的聯系。最后&#xff0c;通過實例代碼演示了如何在代碼中進行單位轉換&…

三分鐘上手安全滲透系統Kali Linux

kali linux系統集成了常用的安全滲透工具&#xff0c;省去了安裝工具的時間&#xff0c;做安全相關的工作是非常推薦使用的。 安裝Kalii Linux 安裝系統 一般使用虛擬機進行安裝&#xff0c;Kali Linux基于Debian內核&#xff0c;虛擬機的操作系統選擇Debian 7.x 64 選擇系統…

【SRC實戰】一鍵完成全部任務獲取獎勵

挖個洞先 https://mp.weixin.qq.com/s/LkPfJuuP1K8vaFXRn-8wVg “ 以下漏洞均為實驗靶場&#xff0c;如有雷同&#xff0c;純屬巧合 ” 01 — 漏洞證明 一、業務邏輯 “ 如何欺騙APP完成任務獲取獎勵&#xff1f; ” 1、記錄金幣數量20 2、瀏覽商品詳情頁 3、點擊瀏覽提…

我們應該如何做參與式觀察

記得多年以前&#xff0c;有個朋友問我&#xff1a;對于做觀察&#xff0c;有人通過教授繪畫技巧來教人如何做觀察。你們研究員又不會畫畫&#xff0c;你們如何讓人相信你們更會觀察呢&#xff1f;坦率說&#xff0c;當時我被問住了&#xff0c;因為我從來沒有進行過這樣的對比…

day5Qt作業

服務器端 #include "widget.h" #include "ui_widget.h"Widget::Widget(QWidget *parent): QWidget(parent), ui(new Ui::Widget) {ui->setupUi(this);//準備組件&#xff0c;初始化組件狀態this->setFixedSize(800,600);chatwidget new QListWidge…

代碼隨想錄算法訓練營第四十九天| 123.買賣股票的最佳時機III,188.買賣股票的最佳時機IV

目錄 題目鏈接&#xff1a;123.買賣股票的最佳時機III 思路 代碼 題目鏈接&#xff1a;188.買賣股票的最佳時機IV 思路 代碼 總結 題目鏈接&#xff1a;123.買賣股票的最佳時機III 思路 與之前買賣股票不同的是本題要求最多買賣兩次&#xff0c;那么dp數組以及遞推公式都…

攻擊者正在利用AI,對保險公司發起大規模欺詐

保險欺詐一直是保險行業面臨的重要挑戰之一&#xff0c;尤其隨著技術的進步&#xff0c;欺詐者也在不斷更新其手段&#xff0c;利用AI技術&#xff0c;包括生成式模型、機器學習和數據分析工具等欺騙保險公司&#xff0c;而AI技術的應用正成為他們的新工具&#xff0c;使其犯罪…

如何打造個人IP?

打造個人IP&#xff08;Intellectual Property&#xff09;是當今社會中越來越受到關注的話題。個人IP指的是個人在某個領域內所擁有的獨特的、具有商業價值的知識、技能、品牌和影響力。為什么要打造個人IP&#xff1f;如何打造個人IP&#xff1f;下面我將為您詳細解答。 首先…

Navicat連接遠程數據庫時,隔一段時間不操作出現的卡頓問題

使用 Navicat 連接服務器上的數據庫時&#xff0c;如果隔一段時間沒有使用&#xff0c;再次點擊就會出現卡頓的問題。 如&#xff1a;隔一段時間再查詢完數據會出現&#xff1a; 2013 - Lost connection to MySQL server at waiting for initial communication packet, syste…

LinkedList鏈表

LinkedList 的全面說明 LinkList底層實現了雙向鏈表和雙端隊列特點可以添加任意元素&#xff08;元素可以重復&#xff09;&#xff0c;包括null線程不安全&#xff0c;沒有實現同步 LinkedList 的底層操作機制 LinkedList底層維護了一個雙向鏈表LinkList中維護了兩個屬性fi…

【算法入門賽】A.坐標變換(推薦學習)C++題解與代碼

比賽鏈接&#xff1a;https://www.starrycoding.com/contest/8 題目描述 武漢市可以看做一個二維地圖。 牢 e e e掌握了一項特異功能&#xff0c;他可以“瞬移”&#xff0c;每次瞬移需要分別設定 x x x和 y y y的偏移量 d x dx dx和 d y dy dy&#xff0c;瞬移完成后位置會…

【Fastadmin】表格列改input框輸入編輯,以排序權重為例

目錄 1.自定義權重排序,以字段sort為例 js列代碼 在// 初始化表格table.bootstrapTable({ });的后面添加事件 api里面增加formatter方法,如果存在角色權限問題,控制器添

谷歌外鏈怎么發?

既要數量也要質量&#xff0c;要保證你的鏈接廣泛分布&#xff0c;在數量上&#xff0c;確實需要你的鏈接在各種平臺上有所展現&#xff0c;這樣能提升你網站的知名度和曝光率&#xff0c;但是&#xff0c;光有數量是不夠的&#xff0c;如果這些鏈接的內容不行&#xff0c;那對…

ARIMA模型在河流水質預測中的應用_含代碼

#水質模型 #時間序列 #python應用 ARIMA 時間序列模型簡介 時間序列是研究數據隨時間變化而變化的一種算法&#xff0c;是一種預測性分析算法。它的基本出發點就是事物發展都有連續性&#xff0c;按照它本身固有的規律進行。ARIMA(p,d,q)模型全稱為差分自回歸移動平均模型 (A…

SSH文件傳輸

一、設置SSH密鑰對&#xff0c;實現記住密碼 要避免每次使用scp或ssh時都輸入密碼&#xff0c;你可以設置SSH密鑰對&#xff08;一對公鑰和私鑰&#xff09;&#xff0c;并將公鑰添加到遠程服務器上。這樣&#xff0c;你的系統可以通過密鑰自動驗證身份&#xff0c;而無需手動…

Blazor入門-基礎知識+vs2022自帶例程的理解

參考&#xff1a; Blazor 教程 - 生成首個應用 https://dotnet.microsoft.com/zh-cn/learn/aspnet/blazor-tutorial/intro Blazor基礎知識&#xff1a;Visual Studio 2022 中的Blazor開發入門_vs2022 blazor webassembly-CSDN博客 https://blog.csdn.net/mzl87/article/detail…

NSSCTF | [SWPUCTF 2021 新生賽]jicao

打開題目&#xff0c;發現高亮顯示了一個 php 腳本 這是腳本的內容 <?php highlight_file(index.php); include("flag.php"); $id$_POST[id]; $jsonjson_decode($_GET[json],true); if ($id"wllmNB"&&$json[x]"wllm") {echo $flag;…