Kubernetes Service 数据包地址转换过程(iptables)

环境说明

CNI 插件:Calico VxLAN 模式

root@k8s-control-plane:/# kubectl get nodes -o wide
NAME                STATUS   ROLES                  AGE   VERSION    INTERNAL-IP   EXTERNAL-IP   OS-IMAGE                         KERNEL-VERSION     CONTAINER-RUNTIME
k8s-control-plane   Ready    control-plane,master   12m   v1.23.17   172.18.0.4    <none>        Debian GNU/Linux 12 (bookworm)   6.5.0-35-generic   containerd://1.7.13
k8s-worker          Ready    <none>                 11m   v1.23.17   172.18.0.3    <none>        Debian GNU/Linux 12 (bookworm)   6.5.0-35-generic   containerd://1.7.13
k8s-worker2         Ready    <none>                 11m   v1.23.17   172.18.0.2    <none>        Debian GNU/Linux 12 (bookworm)   6.5.0-35-generic   containerd://1.7.13

ClusterIP

ClusterIP 类型的 Service 提供一个集群内部的访问点,它的 IP 地址是一个仅在集群内部可路由的虚拟 IP 地址,映射到后端所有处于就绪状态的 Pod。kube-proxy负责维护节点上的网络规则,使流经 ClusterIP 地址的流量能够正确路由到后端可用的 Pod

创建用于测试的 Pod,包含一个名为 client 的 Pod 和一个名为 server 的 DaemonSet

apiVersion: v1
kind: Pod
metadata:
  name: client
  labels:
    app: client
spec:
  containers:
  - name: client
    image: nginx:alpine
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: server
spec:
  selector:
    matchLabels:
      app: server
  template:
    metadata:
      labels:
        
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值