Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- cat <<EOF | kubectl create -f -
- apiVersion: "k8s.cni.cncf.io/v1"
- kind: NetworkAttachmentDefinition
- metadata:
- name: macvlan-conf
- spec:
- config: '{
- "cniVersion": "0.3.0",
- "type": "macvlan",
- "master": "eth0",
- "mode": "bridge",
- "ipam": {
- "type": "host-local",
- "subnet": "192.168.1.0/24",
- "rangeStart": "192.168.1.200",
- "rangeEnd": "192.168.1.216",
- "routes": [
- { "dst": "0.0.0.0/0" }
- ],
- "gateway": "192.168.1.1"
- }
- }'
- EOF
- cat <<EOF | kubectl create -f -
- apiVersion: v1
- kind: Pod
- metadata:
- name: samplepod
- annotations:
- k8s.v1.cni.cncf.io/networks: '[{
- "name": "macvlan-conf",
- "defaultroute": ["192.168.2.1"]
- }]'
- spec:
- containers:
- - name: samplepod
- command: ["/bin/bash", "-c", "trap : TERM INT; sleep infinity & wait"]
- image: dougbtv/centos-network
- EOF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement