大网数据广告活动
服务器运维问答

kubernetes: how to check pod IP range allocated to node

· 52CE 我爱测

Every node in a kubernetes cluster has a dedicated range of IP addresses that it can allocate to the pods. How can one check what that IP range is?

问题原文

原帖链接 · Sergey Guzenkov · CC BY-SA 4.0

Every node in a kubernetes cluster has a dedicated range of IP addresses that it can allocate to the pods. How can one check what that IP range is?

已采纳解答

原帖链接 · Uday · CC BY-SA 4.0

You can do like this in OpenShift:

# oc get hostsubnet
NAME                  HOST                  HOST IP      SUBNET           EGRESS CIDRS   EGRESS IPS
master0.ocp.lab.edu   master0.ocp.lab.edu   10.9.1.175   192.168.2.0/23
master1.ocp.lab.edu   master1.ocp.lab.edu   10.9.1.176   192.168.0.0/23
master2.ocp.lab.edu   master2.ocp.lab.edu   10.9.1.177   192.169.0.0/23
worker0.ocp.lab.edu   worker0.ocp.lab.edu   10.9.1.178   192.170.0.0/23
worker1.ocp.lab.edu   worker1.ocp.lab.edu   10.9.1.179   192.171.0.0/23

And like this in kubernetes:

k get nodes -o custom-columns=NODE:.metadata.name,POD_CIDR:.spec.podCIDR
NODE              POD_CIDR
master.lab.edu    192.168.0.0/24
worker0.lab.edu   192.168.1.0/24
worker1.lab.edu   192.168.2.0/24

Note:- In kubernetes, you can also see against worker nodes:

k get nodes -o custom-columns=NODE:.metadata.name,POD_CIDR:.spec.podCIDR

NODE              POD_CIDR
master.lab.edu    192.168.1.0/24
worker0.lab.edu   <none>
worker1.lab.edu   <none>

This means you need to allocate /16 as pod network cidr during "kubeadm init" process.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2022-10-10)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。