Skip to content

Instantly share code, notes, and snippets.

@Billy99
Created December 3, 2020 19:40
Show Gist options
  • Select an option

  • Save Billy99/5007be27846dbc223971934a3063cf94 to your computer and use it in GitHub Desktop.

Select an option

Save Billy99/5007be27846dbc223971934a3063cf94 to your computer and use it in GitHub Desktop.
apiVersion: v1
kind: Pod
metadata:
name: sriov-pod-1
annotations:
k8s.v1.cni.cncf.io/networks: sriov-net-a, sriov-net-b
spec:
containers:
- name: sriov-example
image: dpdk-app-centos:latest
imagePullPolicy: Never
securityContext:
privileged: true
volumeMounts:
- mountPath: /etc/podnetinfo
name: podnetinfo
readOnly: false
- mountPath: /dev/hugepages
name: hugepage
resources:
requests:
memory: 1Gi
hugepages-1Gi: 1Gi
#hugepages-2Mi: 2048Mi
#cpu: "4"
intel.com/intel_sriov_dpdk_a: '1'
intel.com/intel_sriov_dpdk_b: '1'
limits:
memory: 1Gi
hugepages-1Gi: 1Gi
#hugepages-2Mi: 2048Mi
#cpu: "4"
intel.com/intel_sriov_dpdk_a: '1'
intel.com/intel_sriov_dpdk_b: '1'
# Uncomment to control which DPDK App is running in container.
# If not provided, l3fwd is default.
# Options: l2fwd l3fwd testpmd
#env:
#- name: DPDK_SAMPLE_APP
# value: "l2fwd"
#
# Uncomment to debug DPDK App or to run manually to change
# DPDK command line options.
command: ["sleep", "infinity"]
env:
- name: MY_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: MY_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: MY_POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
- name: sriov-example-2
image: dpdk-app-centos:latest
imagePullPolicy: Never
securityContext:
privileged: true
volumeMounts:
- mountPath: /etc/podnetinfo
name: podnetinfo
readOnly: false
- mountPath: /dev/hugepages
name: hugepage
resources:
requests:
memory: 1Gi
hugepages-1Gi: 2Gi
#hugepages-2Mi: 2048Mi
#cpu: "4"
intel.com/intel_sriov_dpdk_a: '1'
intel.com/intel_sriov_dpdk_b: '1'
limits:
memory: 1Gi
hugepages-1Gi: 2Gi
#hugepages-2Mi: 2048Mi
#cpu: "4"
intel.com/intel_sriov_dpdk_a: '1'
intel.com/intel_sriov_dpdk_b: '1'
# Uncomment to control which DPDK App is running in container.
# If not provided, l3fwd is default.
# Options: l2fwd l3fwd testpmd
#env:
#- name: DPDK_SAMPLE_APP
# value: "l2fwd"
#
# Uncomment to debug DPDK App or to run manually to change
# DPDK command line options.
command: ["sleep", "infinity"]
env:
- name: MY_NODE_NAME
valueFrom:
fieldRef:
fieldPath: spec.nodeName
- name: MY_POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: MY_POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
volumes:
- name: podnetinfo
downwardAPI:
items:
- path: "labels"
fieldRef:
fieldPath: metadata.labels
- path: "annotations"
fieldRef:
fieldPath: metadata.annotations
# Exposing Hugepages via Downward API is an alpha feature in
# Kubernetes 1.20. If K8s is greater than or equal to 1.20 and
# and Feature Gate is enabled (FEATURE_GATES="DownwardAPIHugePages=true"),
# then uncomment the 1G or 2M Hugepage sections below.
#
# 1G Hugepages
- path: "hugepages_1G_request-1"
resourceFieldRef:
containerName: sriov-example
resource: requests.hugepages-1Gi
divisor: 1Mi
- path: "hugepages_1G_limit-1"
resourceFieldRef:
containerName: sriov-example
resource: limits.hugepages-1Gi
divisor: 1Mi
- path: "hugepages_1G_request-2"
resourceFieldRef:
containerName: sriov-example-2
resource: requests.hugepages-1Gi
divisor: 1Mi
- path: "hugepages_1G_limit-2"
resourceFieldRef:
containerName: sriov-example-2
resource: limits.hugepages-1Gi
divisor: 1Mi
#
# 2M Hugepages
#- path: "hugepages_request"
# resourceFieldRef:
# containerName: sriov-example
# resource: requests.hugepages-2Mi
# divisor: 1Mi
#- path: "hugepages_limit"
# resourceFieldRef:
# containerName: sriov-example
# resource: limits.hugepages-2Mi
# divisor: 1Mi
- name: hugepage
emptyDir:
medium: HugePages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment