Skip to content

Commit 1d11ae6

Browse files
committed
Refine some docs
1 parent c37b2f7 commit 1d11ae6

File tree

2 files changed

+55
-6
lines changed

2 files changed

+55
-6
lines changed

_posts/2025-11-16-run-kvms-in-k3s.markdown

Lines changed: 54 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,34 @@ The installation includes two parts, [operator](https://github.com/kubevirt/cont
3636

3737
Then a manual task is required. Exposing the CDI upload proxy. Default installation assigned a self-signed cert to its HTTP interface. So I have to use `IngressRouteTCP` and `DNSEndpoint` for Traefik to work.
3838

39+
```yaml
40+
apiVersion: traefik.io/v1alpha1
41+
kind: IngressRouteTCP
42+
metadata:
43+
name: cdi-uploadproxy
44+
namespace: cdi
45+
spec:
46+
routes:
47+
- match: HostSNI(`cdi-uploadproxy.magicloud.lan`)
48+
services:
49+
- name: cdi-uploadproxy
50+
port: 443
51+
tls:
52+
passthrough: true
53+
---
54+
apiVersion: externaldns.k8s.io/v1alpha1
55+
kind: DNSEndpoint
56+
metadata:
57+
name: cdi-uploadproxy
58+
namespace: cdi
59+
spec:
60+
endpoints:
61+
- dnsName: cdi-uploadproxy.magicloud.lan
62+
recordType: A
63+
targets:
64+
- 192.168.0.102
65+
```
66+
3967
Kubevirt lab shows a demo to use CRD directly download disk image from Internet. It does not work now since many things were changed. I used the "upload" way.
4068
4169
There are two types of VM disk, image file and physical disk. But I do not have physical disk usage at hand. So I just talk about image file here.
@@ -56,13 +84,34 @@ With default CNI, there cannot be another NIC attached to the Pod. And in K3S, t
5684

5785
This is where Multus comes in. It is a layer between Pod and actual CNIs to provide the ability to have more NICs in a Pod.
5886

59-
K3S has something special for Multus, hence the installation should follow [k3s doc](https://docs.k3s.io/networking/multus-ipams) rather than Multus doc. After the installation, a few manual modifications are required.
60-
61-
First, check K3S agent endpoint. By default, it is on port 6444. Multus talks to Kubelet which in K3S is `k3s agent` (`k3s server` is also an agent), which takes `lb-server-port` to specify the port.
87+
K3S has something special for Multus, hence the installation should follow [k3s doc](https://docs.k3s.io/networking/multus-ipams) rather than Multus doc. But that one does not work well, either. The manifest should be:
6288

63-
Then checkout the kubeconfig for Multus, path specified during the installing process. The server address `clusters.cluster.server` generated is the in-cluster one. It does not work since Multus works in Node network. Change it to `server: https://localhost:6444`.
89+
```yaml
90+
apiVersion: helm.cattle.io/v1
91+
kind: HelmChart
92+
metadata:
93+
name: multus
94+
namespace: kube-system
95+
spec:
96+
repo: https://rke2-charts.rancher.io
97+
chart: rke2-multus
98+
targetNamespace: kube-system
99+
valuesContent: |-
100+
config:
101+
fullnameOverride: multus
102+
cni_conf:
103+
confDir: /var/lib/rancher/k3s/agent/etc/cni/net.d
104+
binDir: /var/lib/rancher/k3s/data/cni/
105+
kubeconfig: /var/lib/rancher/k3s/agent/etc/cni/net.d/multus.d/multus.kubeconfig
106+
# Comment the following line when using rke2-multus < v4.2.202
107+
multusAutoconfigDir: /var/lib/rancher/k3s/agent/etc/cni/net.d
108+
manifests:
109+
dhcpDaemonSet: true
110+
thickPlugin:
111+
enabled: true
112+
```
64113

65-
After those, Multus is supposed to be able to contact with K3S. But we still cannot tell as it is not happening right now.
114+
After the installation, Multus is supposed to be able to contact with K3S. But we still cannot tell as it is not happening right now.
66115

67116
For my usage, the next step is creating bridging network attachment definition with DHCP IPAM. Please refer to [cni doc](https://www.cni.dev/plugins/current/main/bridge/) for what the configuration looks like. Kubevirt doc is out-of-dated.
68117

_posts/2025-11-30-use-admission-control-to-ensure-ingress-security.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ The returned data is `AdmissionResponse`, and in mutating case, it does not take
2020

2121
One thing to note, AdmissionControl webhook is required to be TLS securied. And the webhook is used within the cluster (directly via service). Hence I cannot use Ingress + TLS to fulfill the requirement. Since I have Step CA and Cert Manager running in my cluster, I need a way to automatically get cert from Cert Manager and install it to the webhook Pod.
2222

23-
This is where [CSI-driver](https://cert-manager.io/docs/usage/csi-driver) comes to help. After installation, a few things worth noting. The webhook is accessed not by FQDN, so `csi.cert-manager.io/dns-names` should at least include `NAME.NAMESPACE.svc`. By default, Step cert expires in 24 hours, but CSI-driver uses a very long default value. Set `csi.cert-manager.io/duration` accordingly. And csi volume is mounted as root, and user/group read only. If the program is not running as root, Pod `spec.securityContext.fsGroup` should be set properly.
23+
This is where [CSI-driver](https://cert-manager.io/docs/usage/csi-driver) comes to help. After installation, a few things worth noting. The webhook is accessed not by FQDN, so `csi.cert-manager.io/dns-names` should at least include `NAME.NAMESPACE.svc`. By default, Step cert expires in 24 hours, but CSI-driver uses a very long default value. Set `csi.cert-manager.io/duration` accordingly. And csi volume is mounted as root, and user/group read only. If the program is not running as root, Pod `spec.template.spec.volumes.csi.volumeAttributes.csi.cert-manager.io/fs-group` should be set properly.
2424

2525
Then setup the Admission Control. This is where it gets annoying.
2626

0 commit comments

Comments
 (0)