ai

Multus CNI สำหรับมือใหม่ Step by Step — เพิ่ม

multus cni สำหรบมอใหม step by step
Multus CNI สำหรับมือใหม่ Step by Step — เพิ่ม

Multus CNI

Multus CNI สำหรับมือใหม่ Step by Step — เพิ่ม

Multus CNI Meta Plugin Kubernetes Multi-homed Pod Network Interface SR-IOV MACVLAN IPVLAN NetworkAttachmentDefinition Telco 5G NFV Storage Management Production

CNI PluginTypePerformanceIsolationIPAMUse Case
MacvlanL2ดีมากMAC-basedStatic/DHCPDirect LAN access
IPvlanL2/L3ดีมากIP-basedStaticSame MAC needed
BridgeL2ดีBridge-basedStatic/DHCPVM-like networking
SR-IOVHardwareNear bare-metalVF-basedStaticTelco high perf
Host-devicePassthroughดีมากDevice-basedStaticDedicated NIC

Installation

=== Multus CNI Installation ===

Install Multus (thick plugin)

kubectl apply -f https://raw.githubusercontent.com/k8snetworkplumbingwg/multus-cni/master/deployments/multus-daemonset-thick.yml

Verify installation

kubectl get pods -n kube-system | grep multus

kubectl get crd | grep network-attachment

Helm Installation

helm repo add rke2-charts https://rke2-charts.rancher.io

helm install multus rke2-charts/rke2-multus -n kube-system

NetworkAttachmentDefinition — Macvlan

apiVersion: k8s.cni.cncf.io/v1

kind: NetworkAttachmentDefinition

metadata:

name: storage-net

namespace: default

spec:

config: '{

"cniVersion": "0.3.1",

"type": "macvlan",

"master": "eth1",

"mode": "bridge",

"ipam": {

เนื้อหาเกี่ยวข้อง — ทำความเข้าใจ QuestDB Time Series Distributed System

"type": "host-local",

"subnet": "192.168.100.0/24",

"rangeStart": "192.168.100.100",

"rangeEnd": "192.168.100.200",

"gateway": "192.168.100.1"

}

แนะนำเพิ่มเติม — เรียนเทรดกับ iCafeForex

}'

NetworkAttachmentDefinition — SR-IOV

apiVersion: k8s.cni.cncf.io/v1

kind: NetworkAttachmentDefinition

metadata:

name: sriov-net

spec:

config: '{

"cniVersion": "0.3.1",

"type": "sriov",

"vlan": 100,

"ipam": {

"type": "host-local",

"subnet": "10.10.100.0/24"

}

}'

เนื้อหาเกี่ยวข้อง — ดูเพิ่มเติมเรื่อง Elasticsearch OpenSearch Site Reliability SRE

Pod with multiple networks

apiVersion: v1

kind: Pod

metadata:

name: multi-net-pod

annotations:

k8s.v1.cni.cncf.io/networks: storage-net, sriov-net

spec:

containers:

  • name: app

image: nginx

# eth0 = default CNI

# net1 = storage-net (macvlan)

# net2 = sriov-net (sriov)

from dataclasses import dataclass

@dataclass

class NetworkConfig:

name: str

แนะนำเพิ่มเติม — อ่านเพิ่มเติมที่ SiamCafeBook

cni_type: str

subnet: str

interface: str

vlan: str

purpose: str

networks = [

NetworkConfig("cluster-net", "Calico (default)", "10.244.0.0/16", "eth0", "N/A", "Pod-to-Pod default"),

NetworkConfig("storage-net", "Macvlan", "192.168.100.0/24", "net1", "100", "Ceph storage traffic"),

NetworkConfig("mgmt-net", "Macvlan", "192.168.200.0/24", "net2", "200", "SSH monitoring"),

เนื้อหาเกี่ยวข้อง — แนะนำให้อ่าน Snyk Code Security MLOps Workflow

NetworkConfig("data-net", "SR-IOV", "10.10.100.0/24", "net3", "300", "High-speed data plane"),

]

Multi-homed Pod Design

Multus CNI สำหรับมือใหม่ Step by Step — เพิ่ม

=== Multi-homed Pod Examples ===

Verify Pod networks

kubectl exec multi-net-pod -- ip addr show

kubectl exec multi-net-pod -- ip route

kubectl get pods multi-net-pod -o jsonpath='{.metadata.annotations.k8s\.v1\.cni\.cncf\.io/network-status}'

Deployment with Multus

apiVersion: apps/v1

kind: Deployment

metadata:

name: storage-app

spec:

replicas: 3

template:

metadata:

annotations:

k8s.v1.cni.cncf.io/networks: |

[

{"name": "storage-net", "interface": "net1"},

{"name": "mgmt-net", "interface": "net2", "ips": ["192.168.200.50"]}

เนื้อหาเกี่ยวข้อง — อ่านต่อ: Tailwind CSS v4 Machine Learning Pipeline

]

spec:

containers:

  • name: app

image: my-storage-app:latest

@dataclass

class PodNetwork:

pod: str

default_ip: str

additional: str

total_interfaces: int

use_case: str

pods = [

PodNetwork("web-server", "10.244.1.10", "N/A (default only)", 1, "Standard web service"),

PodNetwork("ceph-osd", "10.244.1.20", "storage-net: 192.168.100.20", 2, "Storage + cluster"),

PodNetwork("db-replica", "10.244.1.30", "storage-net: 192.168.100.30, mgmt-net: 192.168.200.30", 3, "DB replication + mgmt"),

PodNetwork("5g-upf", "10.244.1.40", "data-net: 10.10.100.40, mgmt-net: 192.168.200.40", 3, "Telco user plane"),

]

เคล็ดลับ

  • Default CNI: ติดตั้ง Default CNI ก่อน Multus เสมอ
  • Macvlan: เริ่มจาก Macvlan ง่ายที่สุดสำหรับมือใหม่
  • SR-IOV: ใช้ SR-IOV สำหรับ High Performance ต้องมี NIC รองรับ
  • VLAN: ตั้ง VLAN บน Physical Switch ให้ตรงกับ NAD Config
  • Test: ใช้ iperf3 ทดสอบ Bandwidth ระหว่าง Pod บน Additional Network

Multus CNI คืออะไร

Meta CNI Plugin Kubernetes หลาย Network Interface Pod SR-IOV MACVLAN IPVLAN Bridge NFV Telco 5G Storage Management Data Control Plane

XM Legend · เทรดเดอร์ & ผู้สอน Forex 13 ปี

ผู้ก่อตั้ง SiamCafe ตั้งแต่ปี 1997 · เทรดเดอร์สาย Forex มากกว่า 13 ปี ได้รับการยกย่องเป็น XM Legend · แบ่งปันความรู้ Forex, ไอที, AI และการเทรด จากประสบการณ์จริงในตลาดจริง