You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2025-11-16-run-kvms-in-k3s.markdown
+54-5Lines changed: 54 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -36,6 +36,34 @@ The installation includes two parts, [operator](https://github.com/kubevirt/cont
36
36
37
37
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.
38
38
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
+
39
67
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.
40
68
41
69
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
56
84
57
85
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.
58
86
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:
62
88
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`.
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.
66
115
67
116
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.
Copy file name to clipboardExpand all lines: _posts/2025-11-30-use-admission-control-to-ensure-ingress-security.markdown
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,7 +20,7 @@ The returned data is `AdmissionResponse`, and in mutating case, it does not take
20
20
21
21
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.
22
22
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.
24
24
25
25
Then setup the Admission Control. This is where it gets annoying.
0 commit comments