k3s-cluster/cluster/apps/game-servers/network_policy.yaml

38 lines
No EOL
781 B
YAML

apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: deny-most-allow-some
namespace: game-servers
spec:
# Apply to all pods in this namespace
podSelector: {}
ingress:
- from:
# Allow all pods in this namespace
- namespaceSelector:
matchLabels:
name: "game-servers"
# Allow traefik pods
- namespaceSelector:
matchLabels:
name: "traefik"
# Allow all pods with this label
- podSelector:
matchLabels:
needsGameServers: "yes"
egress:
- to:
- ipBlock:
cidr: 192.168.87.0/24 # server lan
ports:
# palworld
- protocol: UDP
port: 8211
- protocol: UDP
port: 38211
- protocol: UDP
port: 25575
- protocol: UDP
port: 32575