forked from nberlee/bonjour-reflector
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
152 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Kubernetes deployment | ||
|
||
## Prepare network | ||
All vlans that need to be reflected should be tagged to the kubernetes node(s) interface. If you only want to to run the reflector exclusively on one node, you can use the `nodeName` in the deployment yaml. | ||
|
||
## Create configmap | ||
The configmap is created by kustomize. Please make sure to change the `config.toml` to your needs. See the [config.md](../config.md) for detailed explaination. | ||
|
||
## Cilium | ||
If you are running Cilium as your CNI, you need to add the following to your cilium configmap: | ||
```yaml | ||
vlan-bpf-bypass: "0" | ||
``` | ||
This will prevent cilium from dropping tagged packets. | ||
## Deploy | ||
The manifests in manifests/ will create a namespace, deployment and configmap. The deployment will run on the host network, so it can access the vlans. The configmap is mounted as a volume in the container. | ||
```bash | ||
kubectl apply -k manifests/ | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: "cilium.io/v2" | ||
kind: CiliumNetworkPolicy | ||
metadata: | ||
name: "deny-all" | ||
namespace: mdns | ||
spec: | ||
endpointSelector: | ||
matchLabels: | ||
app: bonjour | ||
egress: | ||
- {} | ||
ingress: | ||
- {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
net_interface = "eth0" | ||
|
||
[devices] | ||
|
||
[devices."71:27:06:20:A7:E6"] | ||
description = "Bedroom TV" | ||
origin_pool = 100 | ||
shared_pools = [101, 103] | ||
|
||
[devices."01:10:B1:E1:69:98"] | ||
description = "Onkyo amplifier" | ||
origin_pool = 100 | ||
shared_pools = [101, 103] | ||
|
||
[devices."00:04:4B:5D:F2:D3"] | ||
description = "NVidia Shield" | ||
origin_pool = 100 | ||
shared_pools = [101, 103] | ||
|
||
[devices."DC:A6:32:2B:31:19"] | ||
description = "Volumio bathroom" | ||
origin_pool = 103 | ||
shared_pools = [101] | ||
|
||
[vlan] | ||
|
||
[vlan.100] | ||
ip_source = "192.168.100.2" | ||
|
||
[vlan.101] | ||
ip_source = "192.168.101.2" | ||
|
||
[vlan.103] | ||
ip_source = "192.168.103.2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: bonjour-reflector | ||
namespace: mdns | ||
spec: | ||
replicas: 1 | ||
strategy: | ||
rollingUpdate: | ||
maxSurge: 1 | ||
maxUnavailable: 1 | ||
type: RollingUpdate | ||
selector: | ||
matchLabels: | ||
app: bonjour | ||
template: | ||
metadata: | ||
labels: | ||
app: bonjour | ||
spec: | ||
hostNetwork: true | ||
# nodeName: talos-home-4 | ||
serviceAccountName: bonjour-reflector | ||
containers: | ||
- image: ghcr.io/nberlee/bonjour-reflector:main | ||
imagePullPolicy: Always | ||
name: bonjour-reflector | ||
# command: | ||
# - "/bonjour-reflector" | ||
# - "-verbose" | ||
securityContext: | ||
readOnlyRootFilesystem: true | ||
allowPrivilegeEscalation: false | ||
capabilities: | ||
add: | ||
- NET_RAW | ||
drop: | ||
- ALL | ||
seccompProfile: | ||
type: RuntimeDefault | ||
resources: | ||
limits: | ||
memory: 150Mi | ||
requests: | ||
cpu: 200m | ||
memory: 150Mi | ||
volumeMounts: | ||
- name: config | ||
mountPath: "/config.toml" | ||
subPath: config.toml | ||
readOnly: true | ||
volumes: | ||
- name: config | ||
configMap: | ||
name: bonjour-reflector-config |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
namespace: mdns | ||
|
||
resources: | ||
- namespace.yaml | ||
- serviceaccount.yaml | ||
- deployment.yaml | ||
# - cnp.yaml | ||
|
||
|
||
configMapGenerator: | ||
- name: bonjour-reflector-config | ||
files: | ||
- config/config.toml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
creationTimestamp: null | ||
name: mdns | ||
spec: {} | ||
status: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
creationTimestamp: null | ||
name: bonjour-reflector | ||
namespace: mdns | ||
|
||
automountServiceAccountToken: false |