[TOC]
### **简介**
whereabouts是一个cluster-wide(集群级别)的IPAM插件。它非常适合用在NetworkAttachment的场景。
本文 cilium(或其他) + multus + ipvlan给容器设置双网卡,ipvlan使用whereabouts来分配置IP
### **准备条件**
安装好K8S集群,以及master-plugin网络插件(可以是calico、flannel等)
安装好multus
### **安装Whereabouts**
```
$ git clone https://github.com/k8snetworkplumbingwg/whereabouts && cd whereabouts
$ kubectl apply \
-f doc/crds/daemonset-install.yaml \
-f doc/crds/whereabouts.cni.cncf.io_ippools.yaml \
-f doc/crds/whereabouts.cni.cncf.io_overlappingrangeipreservations.yaml \
-f doc/crds/ip-reconciler-job.yaml
```
### **创建NetworkAttachmentDefinition**
```
apiVersion: "k8s.cni.cncf.io/v1"
kind: NetworkAttachmentDefinition
metadata:
name: ipvlan
spec:
config: '{
"cniVersion": "0.3.0",
"type": "ipvlan",
"master": "ens37",
"ipam": {
"type": "whereabouts",
"range": "10.10.0.0/16"
}
}'
```
### **创建Pod**
```
apiVersion: apps/v1
kind: Deployment
metadata:
name: apline
spec:
replicas: 2
selector:
matchLabels:
k8s-app: apline
template:
metadata:
annotations:
k8s.v1.cni.cncf.io/networks: ipvlan
labels:
k8s-app: apline
spec:
containers:
- name: alpine
command: ["/bin/ash", "-c", "trap : TERM INT; sleep infinity & wait"]
image: alpine
imagePullPolicy: IfNotPresent
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchLabels:
k8s-app: apline
topologyKey: topology.kubernetes.io/hostname
```
### **查看**
查看Pod
```
$ kubectl get pod -o wide
NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
apline-66b6bcc945-mmtdg 1/1 Running 0 3m42s 172.26.0.16 192.168.92.108 <none> <none>
apline-66b6bcc945-mvx79 1/1 Running 0 6m7s 172.26.1.28 192.168.92.109 <none> <none>
```
查看crd
```
$ kubectl get crd | grep whereabouts
ippools.whereabouts.cni.cncf.io 2022-04-12T03:46:35Z
overlappingrangeipreservations.whereabouts.cni.cncf.io 2022-04-12T03:46:35Z
```
查看`ippools.whereabouts.cni.cncf.io`
```
$ kubectl get ippools.whereabouts.cni.cncf.io --all-namespaces
NAMESPACE NAME AGE
kube-system 10.10.0.0-16 8m8s
$ kubectl get ippools.whereabouts.cni.cncf.io 10.10.0.0-16 -n kube-system -o yaml
apiVersion: whereabouts.cni.cncf.io/v1alpha1
kind: IPPool
metadata:
creationTimestamp: "2022-04-12T03:48:42Z"
generation: 3
name: 10.10.0.0-16
namespace: kube-system
resourceVersion: "7915"
uid: 06232e5a-cd53-4f78-86a9-c45b3f5f7128
spec:
allocations:
"1":
id: 1f3284446437c013e2ca20f6a6b6fefcca7dfd5637c3f16b80a3826296a05722
podref: default/apline-66b6bcc945-mvx79
"2":
id: e458b21602f47e42b60e53fa58e4863b15d3c46bee280fa65060c780f8cce5f0
podref: default/apline-66b6bcc945-mmtdg
range: 10.10.0.0/16
```
查看`overlappingrangeipreservations.whereabouts.cni.cncf.io`
```
$ kubectl get overlappingrangeipreservations.whereabouts.cni.cncf.io --all-namespaces
NAMESPACE NAME AGE
kube-system 10.10.0.1 8m40s
kube-system 10.10.0.2 6m14s
$ kubectl get overlappingrangeipreservations.whereabouts.cni.cncf.io 10.10.0.1 -o yaml -n kube-system
apiVersion: whereabouts.cni.cncf.io/v1alpha1
kind: OverlappingRangeIPReservation
metadata:
creationTimestamp: "2022-04-12T03:48:42Z"
generation: 1
name: 10.10.0.1
namespace: kube-system
resourceVersion: "7602"
uid: 2e5ed8b5-41ee-4a0a-8580-19e7a0bb2649
spec:
containerid: 1f3284446437c013e2ca20f6a6b6fefcca7dfd5637c3f16b80a3826296a05722
podref: default/apline-66b6bcc945-mvx79
```
- 常用命令
- 安装
- 安装Kubeadm
- 安装单Master集群
- 安装高可用集群(手动分发证书)
- 安装高可用集群(自动分发证书)
- 启动参数解析
- certificate-key
- ETCD相关参数
- Kubernetes端口汇总
- 安装IPv4-IPv6双栈集群
- 下载二进制文件
- 使用Kata容器
- 快速安装shell脚本
- 存储
- 实践
- Ceph-RBD实践
- CephFS实践
- 对象存储
- 阿里云CSI
- CSI
- 安全
- 认证与授权
- 认证
- 认证-实践
- 授权
- ServiceAccount
- NodeAuthorizor
- TLS bootstrapping
- Kubelet的认证
- 准入控制
- 准入控制示例
- Pod安全上下文
- Selinux-Seccomp-Capabilities
- 给容器配置安全上下文
- PodSecurityPolicy
- K8S-1.8手动开启认证与授权
- Helm
- Helm命令
- Chart
- 快速入门
- 内置对象
- 模板函数与管道
- 模板函数列表
- 流程控制
- Chart依赖
- Repository
- 开源的Chart包
- CRD
- CRD入门
- 工作负载
- Pod
- Pod的重启策略
- Container
- 探针
- 工作负载的状态
- 有状态服务
- 网络插件
- Multus
- Calico+Flannel
- 容器网络限速
- 自研网络插件
- 设计文档
- Cilium
- 安装Cilium
- Calico
- Calico-FAQ
- IPAM
- Whereabouts
- 控制平面与Pod网络分开
- 重新编译
- 编译kubeadm
- 编译kubeadm-1.23
- 资源预留
- 资源预留简介
- imagefs与nodefs
- 资源预留 vs 驱逐 vs OOM
- 负载均衡
- 灰度与蓝绿
- Ingress的TLS
- 多个NginxIngressController实例
- Service的会话亲和
- CNI实践
- CNI规范
- 使用cnitool模拟调用
- CNI快速入门
- 性能测试
- 性能测试简介
- 制作kubemark镜像
- 使用clusterloader2进行性能测试
- 编译clusterloader2二进制文件
- 搭建性能测试环境
- 运行density测试
- 运行load测试
- 参数调优
- Measurement
- TestMetrics
- EtcdMetrics
- SLOMeasurement
- PrometheusMeasurement
- APIResponsivenessPrometheus
- PodStartupLatency
- FAQ
- 调度
- 亲和性与反亲和性
- GPU
- HPA
- 命名规范
- 可信云认证
- 磁盘限速
- Virtual-kubelet
- VK思路整理
- Kubebuilder
- FAQ
- 阿里云日志服务SLS
