Skip to content

Commit 3a2f976

Browse files
fix(post): Added more examples for multus
1 parent b6047f9 commit 3a2f976

File tree

1 file changed

+85
-0
lines changed

1 file changed

+85
-0
lines changed

_posts/2024-04-14-advanced-kubernetes-networking.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,91 @@ network:
490490

491491
If you know of a better way to do this, please let me know in the comments.
492492

493+
### k3s
494+
495+
You will have to make some changes for this to work with `k3s`. Thanks [ThePCGeek](https://github.com/ChrisThePCGeek)!
496+
497+
```yaml
498+
# k3s multus install
499+
apiVersion: helm.cattle.io/v1
500+
kind: HelmChart
501+
metadata:
502+
name: multus
503+
namespace: kube-system
504+
spec:
505+
repo: https://rke2-charts.rancher.io
506+
chart: rke2-multus
507+
targetNamespace: kube-system
508+
# createNamespace: true
509+
valuesContent: |-
510+
config:
511+
cni_conf:
512+
confDir: /var/lib/rancher/k3s/agent/etc/cni/net.d
513+
clusterNetwork: /var/lib/rancher/k3s/agent/etc/cni/net.d/10-flannel.conflist
514+
binDir: /var/lib/rancher/k3s/data/current/bin/
515+
kubeconfig: /var/lib/rancher/k3s/agent/etc/cni/net.d/multus.d/multus.kubeconfig
516+
```
517+
518+
### mac-vlan
519+
520+
I have also used this `mac-vlan` config below successfully
521+
522+
```yaml
523+
---
524+
apiVersion: "k8s.cni.cncf.io/v1"
525+
kind: NetworkAttachmentDefinition
526+
metadata:
527+
name: multus-iot
528+
namespace: default
529+
spec:
530+
config: |-
531+
{
532+
"cniVersion": "0.3.1",
533+
"name": "multus-iot",
534+
"plugins": [
535+
{
536+
"type": "macvlan",
537+
"master": "eth1",
538+
"mode": "bridge",
539+
"capabilities": {
540+
"ips": true
541+
},
542+
"ipam": {
543+
"type": "static",
544+
"routes": [{
545+
"dst": "192.168.0.0/16",
546+
"gw": "192.168.20.1"
547+
}]
548+
}
549+
}
550+
]
551+
}
552+
```
553+
554+
Sample Pods
555+
556+
```yaml
557+
apiVersion: v1
558+
kind: Pod
559+
metadata:
560+
name: sample-pod
561+
namespace: default
562+
annotations:
563+
k8s.v1.cni.cncf.io/networks: |
564+
[{
565+
"name": "multus-iot",
566+
"namespace": "default",
567+
"mac": "c6:5e:a4:8e:7a:59",
568+
"ips": ["192.168.20.210/24"],
569+
"gateway": [ "192.168.20.1" ]
570+
}]
571+
spec:
572+
containers:
573+
- name: sample-pod
574+
command: ["/bin/ash", "-c", "trap : TERM INT; sleep infinity & wait"]
575+
image: alpine
576+
```
577+
493578
## Join the conversation
494579

495580
<blockquote class="twitter-tweet" data-dnt="true" data-theme="dark"><p lang="en" dir="ltr">Today I released 40 minute, super niche technical video on advanced Kubernetes networking with Multus. <br><br>I didn&#39;t do it for the algorithm, I did it because I loved every minute of it. (Well, after I got it working)<a href="https://t.co/O7sLjDIMXt">https://t.co/O7sLjDIMXt</a> <a href="https://t.co/bBnBbmlsDx">pic.twitter.com/bBnBbmlsDx</a></p>&mdash; Techno Tim (@TechnoTimLive) <a href="https://twitter.com/TechnoTimLive/status/1779516238533627905?ref_src=twsrc%5Etfw">April 14, 2024</a></blockquote> <script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>

0 commit comments

Comments
 (0)