Multi-Homed Pod with Static IP

ID Date Version Classification
774270 03/24/2023 1.0 Public

Pod with Extra NIC

Deploy a Pod with an extra NIC:

cat <<EOF > macvlan-static-pod.yaml
apiVersion: v1
kind: Pod
metadata:
  name: macvlan-static
  annotations:
    k8s.v1.cni.cncf.io/networks: macvlan-static
spec:
  containers:
  - name: alpine
    image: alpine
    command: ["sleep", "infinity"]
EOF
kubectl apply -f macvlan-static-pod.yaml

# wait until it is running
kubectl get po -w

# check the NICs of the Pod
# there should be two NICs: eth0 and net1
kubectl describe pod macvlan-static | grep multus

# or you can check inside the Pod
kubectl exec macvlan-static -- ip a
kubectl exec macvlan-static -- ip r