Specifying a Subnet for a Pod
Scenario
If the pod network contains multiple subnets, you can use the yangtse.io/subnets annotation to specify the subnets after a pod is created.
Constraints
- A maximum of 20 subnets can be specified for a pod.
- The subnets specified for a pod must be included in the pod network configuration.
- Multiple subnets are separated using commas (,).
- There must be idle IP addresses in each subnet, or the pod fail to be created due to insufficient IP addresses.
Using kubectl
You can add annotations to a workload to specify the subnets for each pod.
apiVersion: cci/v2
kind: Deployment
metadata:
annotations:
description: ''
labels: {}
name: nginx
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
annotations:
vm.cci.io/pod-size-specs: 2.00_4.0
resource.cci.io/pod-size-specs: 2.00_4.0
metrics.alpha.kubernetes.io/custom-endpoints: '[{api:'''',path:'''',port:'''',names:''''}]'
yangtse.io/subnets: ${subnetID1},${subnetID2} # Subnets specified for the pod
log.stdoutcollection.kubernetes.io: '{"collectionContainers": ["container-0"]}'
labels:
app: nginx
spec:
containers:
- image: library/nginx:stable-alpine-perl
name: container-0
resources:
limits:
cpu: 2000m
memory: 4096Mi
requests:
cpu: 2000m
memory: 4096Mi
command: []
lifecycle: {}
dnsPolicy: ''
imagePullSecrets:
- name: imagepull-secret
dnsConfig: {}
minReadySeconds: 0
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 0
maxUnavailable: 1
yangtse.io/subnets: IDs of the subnets to be specified for a pod
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.