kubernetes集群搭建(4):node节点安装

下列所有操作需要在所有node节点上操作,并注意红色部分的修改

1.node节点不需要安装etcd来存储相关信息

yum -y install flannel kubernetes

2.修改flanneld网络相关信息 

复制代码
[root@k8s-node1 ~]# vi  /etc/sysconfig/flanneld 

# Flanneld configuration options
FLANNEL_ETCD="http://k8s-master:2379"
# etcd url location.  Point this to the server where etcd runs
FLANNEL_ETCD_ENDPOINTS="http://k8s-master:2379"

# etcd config key.  This is the configuration key that flannel queries
# For address range assignment
FLANNEL_ETCD_PREFIX="/atomic.io/network"

# Any additional options that you want to pass
#FLANNEL_OPTIONS=""
复制代码

注意: /atomic.io/network 需与  master配置第7步中配置 etcdctl mk /atomic.io/network/config '{"Network":"172.16.0.0/16"}' 名称一致

3.kubelet config信息

复制代码
[root@k8s-node1 ~]# vi /etc/kubernetes/config 

###
# kubernetes system config
#
# The following values are used to configure various aspects of all
# kubernetes services, including
#
#   kube-apiserver.service
#   kube-controller-manager.service
#   kube-scheduler.service
#   kubelet.service
#   kube-proxy.service
# logging to stderr means we get it in the systemd journal
KUBE_LOGTOSTDERR="--logtostderr=true"

# journal message level, 0 is debug
KUBE_LOG_LEVEL="--v=0"

# Should this cluster be allowed to run privileged docker containers
KUBE_ALLOW_PRIV="--allow-privileged=false"

# How the controller-manager, scheduler, and proxy find the apiserver
KUBE_MASTER="--master=http://k8s-master:8080"
复制代码

4.kubelet 核心文件修改

复制代码
[root@k8s-node1 ~]# vi /etc/kubernetes/kubelet 

# The address for the info server to serve on (set to 0.0.0.0 or "" for all interfaces)
KUBELET_ADDRESS="--address=0.0.0.0"

# The port for the info server to serve on
KUBELET_PORT="--port=10250"

# You may leave this blank to use the actual hostname
KUBELET_HOSTNAME="--hostname-override=k8s-node1"

# location of the api-server
KUBELET_API_SERVER="--api-servers=http://k8s-master:8080"

# pod infrastructure container
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=192.168.100.6:5000/rhel7/pod-infrastructure:1.0"

KUBELET_ARGS="--cluster-dns=10.254.0.2 --cluster-domain=cluster.local"
复制代码

注意:修改 KUBELET_HOSTNAME 中节点信息,KUBELET_POD_INFRA_CONTAINER 对应到私库地址 , KUBELET_ARGS 配置的为dns解析信息 和master配置第4步 配置一致

 

5.启动服务

for SERVICES in kube-proxy kubelet flanneld; do
    systemctl restart $SERVICES
    systemctl enable $SERVICES
    systemctl status $SERVICES 
done

 

6.在master节点上测试配置是否成功。如果看到红色信息,表示环境搭建成功

[root@k8s-master ~]# kubectl get nodes
NAME        STATUS    AGE
k8s-node1   Ready     11d
k8s-node2   Ready     11d
[root@k8s-master ~]# 

 

posted @   肖哥哥  阅读(2514)  评论(0编辑  收藏  举报
编辑推荐:
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 基于Microsoft.Extensions.AI核心库实现RAG应用
· Linux系列:如何用heaptrack跟踪.NET程序的非托管内存泄露
· 开发者必知的日志记录最佳实践
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 从HTTP原因短语缺失研究HTTP/2和HTTP/3的设计差异
· 三行代码完成国际化适配,妙~啊~
历史上的今天:
2016-04-23 SpringMVC中定时任务配置
生命不息  奋斗不止  每天进步一点点
点击右上角即可分享
微信分享提示