NetworkPolicy - ingress
All checks were successful
/ continuous-deploy (push) Successful in 27s

This commit is contained in:
Márcio Fernandes
2026-03-18 13:44:50 +00:00
parent f1ad238669
commit 3c7adbc9e6
2 changed files with 48 additions and 0 deletions

View File

@@ -5,6 +5,7 @@ resources:
- continuous-deploy-account.yaml
- network-policies/egress.yaml
- network-policies/egress-local-services.yaml
- network-policies/ingress.yaml
generatorOptions:
disableNameSuffixHash: true

View File

@@ -0,0 +1,47 @@
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: git-limbosolutions-com-ingress
namespace: git-limbosolutions-com
spec:
# Apply this policy only to the Gitea pods
podSelector:
matchLabels:
app.kubernetes.io/name: gitea
policyTypes:
- Ingress
ingress:
# ---------------------------------------------------------------------
# Allow HTTPS (3000) ONLY from Traefik running in kube-system
# ---------------------------------------------------------------------
- from:
- namespaceSelector:
matchLabels:
kubernetes.io/metadata.name: kube-system
podSelector:
matchLabels:
app.kubernetes.io/name: traefik
ports:
- protocol: TCP
port: http # HTTPS routed by Traefik
# ---------------------------------------------------------------------
# Allow SSH (2222) from the internet, but block all internal traffic
#
# - cidr: 0.0.0.0/0 allows all external IPs
# - except: blocks all cluster networks
#
# This forces ALL SSH traffic to come through external firewall
# ,preventing pod-to-pod or service-to-pod SSH access.
# ---------------------------------------------------------------------
- from:
- ipBlock:
cidr: 0.0.0.0/0
except:
- 10.0.0.0/16 # Pod network (blocks all pods)
- 10.43.0.0/16 # Service network (blocks ClusterIP access)
ports:
- protocol: TCP
port: ssh # ssh port routed by firewall