Files
Deploy-Laboratory/ansible/files/06-01/networkpolicy-backend-ingress.example.yaml
2026-03-29 09:08:01 +08:00

22 lines
555 B
YAML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 示例:后端 Namespace 仅允许来自 kube-systemTraefik的入站
# 将 namespace、podSelector、端口改为你的应用标签与 Service 端口。
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: backend-from-traefik-example
namespace: default
spec:
podSelector:
matchLabels:
app: nginx
policyTypes:
- Ingress
ingress:
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
ports:
- protocol: TCP
port: 80