Skip to content

Create Pods in specific Network

Huanyu He edited this page Mar 21, 2022 · 5 revisions

Annotating pods with "networking.alibaba.com/specified-network" makes them be created in a specified Network.

For example:

---
apiVersion: networking.alibaba.com/v1
kind: Network
metadata:
  name: underlay-network1
spec:
  netID: 0
  nodeSelector:
    network: network1
  switchID: physical-switch1
  type: Underlay

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: curl-deployment
spec:
  selector:
    matchLabels:
      app: curl
  replicas: 6
  template:
    metadata:
      annotations:
        networking.alibaba.com/specified-network: underlay-network1
      labels:
        app: curl
    spec:
      containers:
      - args:
        - -c
        - sleep 999999999
        command:
        - /bin/sh
        name: curl
        image: tutum/curl:alpine