当前位置:网站首页>Le Cluster kubernets en cours d'exécution veut ajuster l'adresse du segment réseau du pod
Le Cluster kubernets en cours d'exécution veut ajuster l'adresse du segment réseau du pod
2022-07-07 11:29:00 【Jiangxl】
En coursK8SRegroupementPodAdresse du segment réseau pour
Catalogue des articles
- En coursK8SRegroupementPodAdresse du segment réseau pour
- 1.ModifierPodContexte de l'adresse du segment
- 2.En coursK8SInformations sur le cluster
- 3.D'abord.K8SLe Cluster construit unPod
- 4.AjustementK8SClusterPodSegment réseau
- 4.1.AjustementK8SSegment réseau du pool d'adresses
- 4.2.AjustementController-ManagerSegment réseau du composant
- 4.4.AjustementKube-proxyAdresse du segment
- 4.5.AjustementK8SCluster tous les noeudsyamlAdresse du segment réseau dans le fichier
- 4.6.Redémarrage de tous les noeudskubelet
- 4.7.RedémarrerK8SEn grappesPod
1.ModifierPodContexte de l'adresse du segment
UtilisersealosDéploiementK8SCluster,Par défautPodLe segment réseau est100.64.0.0/16,Il n'y a aucun problème à fonctionner dans un environnement privatisé,Mais quand le cluster est déployé dans alicloudECSAprès le milieu,AdoptionSLBCharge à sept niveauxK8SLorsqu'il s'agit d'applications dans un Cluster,Une exception d'accès se produit,Le paquet ne peut pas être retourné correctement àSLB, Après discussion avec les ingénieurs d'Alibaba Cloud ,SLBTransmisProxyLe segment réseau est100.64.0.0/16,AvecK8S Pod Conflit d'adresses de segment pour , Cela peut causer des anomalies du réseau .
2.En coursK8SInformations sur le cluster
[[email protected] ~]# kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-master Ready master 6m43s v1.19.16
k8s-node-1 Ready <none> 6m13s v1.19.16
k8s-node-2 Ready <none> 6m13s v1.19.16
À l'heure actuellePod L'adresse du segment réseau est 100Segment réseau, On va l'ajuster à 10.10.0.0/18.

3.D'abord.K8SLe Cluster construit unPod
D'abord.K8SLe Cluster construit unPod, Observez avant et après la modification du segment réseau PodDisponible ou non.
1) Fichier d'orchestration des ressources
[[email protected]-master k8s]# cat nginx.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nginx
name: nginx
namespace: default
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- image: nginx
imagePullPolicy: Always
name: nginx
ports:
- containerPort: 80
name: http
protocol: TCP
- containerPort: 443
name: https
protocol: TCP
---
apiVersion: v1
kind: Service
metadata:
labels:
app: nginx
name: nginx-80-443
namespace: default
spec:
ports:
- name: http
port: 80
protocol: TCP
targetPort: 80
- name: https
port: 443
protocol: TCP
targetPort: 443
selector:
app: nginx
type: NodePort
2)Déploiement
[[email protected] k8s]# kubectl get all
NAME READY STATUS RESTARTS AGE
pod/nginx-6b89b7f467-ct6md 1/1 Running 0 8m32s
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 26m
service/nginx-80-443 NodePort 10.99.243.115 <none> 80:31575/TCP,443:31418/TCP 8m32s
NAME READY UP-TO-DATE AVAILABLE AGE
deployment.apps/nginx 1/1 1 1 8m32s
NAME DESIRED CURRENT READY AGE
replicaset.apps/nginx-6b89b7f467 1 1 1 8m32s
4.AjustementK8SClusterPodSegment réseau
4.1.AjustementK8SSegment réseau du pool d'adresses
1.VoirK8S Pool d'adresses par défaut
[[email protected] k8s]# kubectl get ippool
NAME AGE
default-ipv4-ippool 18m
2. Ajuster la plage d'adresses du pool d'adresses
[[email protected] k8s]# kubectl edit ippool default-ipv4-ippool
cidr: 10.10.0.0/18

4.2.AjustementController-ManagerSegment réseau du composant
[[email protected]k8s-master k8s]# vim /etc/kubernetes/manifests/kube-controller-manager.yaml
- --cluster-cidr=10.10.0.0/18

4.4.AjustementKube-proxyAdresse du segment
[root@k8s-master k8s]# kubectl edit cm kube-proxy -n kube-system
clusterCIDR: 10.10.0.0/18
4.5.AjustementK8SCluster tous les noeudsyamlAdresse du segment réseau dans le fichier
Combien?Node Combien de fois faites - vous la même chose .
[[email protected] k8s]# kubectl get nodes k8s-master -o yaml > master.yaml
[[email protected] k8s]# kubectl get nodes k8s-node-1 -o yaml > node-1.yaml
[[email protected] k8s]# kubectl get nodes k8s-node-2 -o yaml > node-2.yaml
[[email protected] k8s]# vim master.yaml
v:"10.10.0.0/18": {}
spec:
podCIDR: 10.10.0.0/18
podCIDRs:
- 10.10.0.0/18

[root@k8s-master k8s]# kubectl delete node k8s-master
node "k8s-master" deleted
[root@k8s-master k8s]# kubectl apply -f master.yaml
node/k8s-master created
[root@k8s-master k8s]# kubectl delete node k8s-node-1
node "k8s-node-1" deleted
[root@k8s-master k8s]# kubectl delete node k8s-node-2
node "k8s-node-2" deleted
[root@k8s-master k8s]# kubectl apply -f node-1.yaml
node/k8s-node-1 created
[root@k8s-master k8s]# kubectl apply -f node-2.yaml
node/k8s-node-2 created
4.6.Redémarrage de tous les noeudskubelet
systemctl restart kubelet
4.7.RedémarrerK8SEn grappesPod
[[email protected] k8s]# kubectl delete pod nginx-6b89b7f467-ct6md
pod "nginx-6b89b7f467-ct6md" deleted
[[email protected] k8s]# kubectl get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
nginx-6b89b7f467-869m2 1/1 Running 0 23s 10.10.5.129 k8s-node-1 <none> <none>
Pod L'adresse a été modifiée avec succès .
边栏推荐
- The opacity value becomes 1%
- 数据库同步工具 DBSync 新增对MongoDB、ES的支持
- 通过 Play Integrity API 的 nonce 字段提高应用安全性
- 普通测试年薪15w,测试开发年薪30w+,二者差距在哪?
- 简单介绍一下闭包及它的一些应用场景
- Common SQL statement collation: MySQL
- 测试开发基础,教你做一个完整功能的Web平台之环境准备
- [encapsulation of time format tool functions]
- 基于Retrofit框架的金山API翻译功能案例
- Force buckle 1002 Find common characters
猜你喜欢

基于华为云IOT设计智能称重系统(STM32)

高考作文,高频提及科技那些事儿……

Interprocess communication (IPC)

对比学习之 Unsupervised Learning of Visual Features by Contrasting Cluster Assignments

基于DE2 115开发板驱动HC_SR04超声波测距模块【附源码】

Force buckle 1002 Find common characters

科普达人丨一文弄懂什么是云计算?

Technology sharing | packet capturing analysis TCP protocol

聊聊SOC启动(十) 内核启动先导知识

从色情直播到直播电商
随机推荐
How to remove addition and subtraction from inputnumber input box
Apprentissage comparatif non supervisé des caractéristiques visuelles par les assignations de groupes de contrôle
RationalDMIS2022阵列工件测量
Which securities company is the best and safest to open an account for the subscription of new shares
STM32 entry development uses IIC hardware timing to read and write AT24C08 (EEPROM)
QT implements the delete method of the container
[Yugong series] go teaching course 005 variables in July 2022
0.96 inch IIC LCD driver based on stc8g1k08
Distributed database master-slave configuration (MySQL)
STM32 entry development NEC infrared protocol decoding (ultra low cost wireless transmission scheme)
TDengine 社区问题双周精选 | 第二期
Basic knowledge of process (orphan, zombie process)
Input type= "password" how to solve the problem of password automatically brought in
Vscode 尝试在目标目录创建文件时发生一个错误:拒绝访问【已解决】
Easyui学习整理笔记
关于测试人生的一站式发展建议
Zhou Yajin, a top safety scholar of Zhejiang University, is a curiosity driven activist
Design intelligent weighing system based on Huawei cloud IOT (STM32)
学习笔记|数据小白使用DataEase制作数据大屏
R语言可视化分面图、假设检验、多变量分组t检验、可视化多变量分组分面箱图(faceting boxplot)并添加显著性水平、添加抖动数据点(jitter points)