network policies
This commit is contained in:
@@ -36,15 +36,6 @@ http {
|
||||
listen 80;
|
||||
server_name ~^(?<subdomain>.+)\.dev\.mrcynic\.site$;
|
||||
|
||||
# Inform NGINX how to read the client IP from X-Forwarded-For
|
||||
real_ip_header X-Forwarded-For;
|
||||
set_real_ip_from 192.168.0.1;
|
||||
real_ip_recursive on;
|
||||
|
||||
# Block if not LAN (192.168.0.0/24). You can expand or tighten this as needed.
|
||||
allow 192.168.0.0/24;
|
||||
deny all;
|
||||
|
||||
location / {
|
||||
proxy_pass http://internal_ingress;
|
||||
proxy_set_header Host $host;
|
||||
|
||||
6
controllers/kustomization.yaml
Normal file
6
controllers/kustomization.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- external-controller.yaml
|
||||
- internal-controller.yaml
|
||||
@@ -4,11 +4,11 @@ kind: Kustomization
|
||||
namespace: ingress-nginx
|
||||
|
||||
resources:
|
||||
- external-controller.yaml
|
||||
- internal-controller.yaml
|
||||
- namespace.yaml
|
||||
- services.yaml
|
||||
- proxy.yaml
|
||||
- policies
|
||||
- controllers
|
||||
|
||||
configMapGenerator:
|
||||
- name: proxy-config
|
||||
|
||||
13
policies/external-policy.yaml
Normal file
13
policies/external-policy.yaml
Normal file
@@ -0,0 +1,13 @@
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: allow-all-ingress-nginx-external
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: nginx-external
|
||||
policyTypes:
|
||||
- Ingress
|
||||
ingress:
|
||||
- {}
|
||||
20
policies/internal-policy.yaml
Normal file
20
policies/internal-policy.yaml
Normal file
@@ -0,0 +1,20 @@
|
||||
---
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: NetworkPolicy
|
||||
metadata:
|
||||
name: restrict-ingress-nginx-internal
|
||||
spec:
|
||||
podSelector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: nginx-internal
|
||||
policyTypes:
|
||||
- Ingress
|
||||
ingress:
|
||||
- from:
|
||||
- ipBlock:
|
||||
cidr: 192.168.0.0/16
|
||||
ports:
|
||||
- protocol: TCP
|
||||
port: 80
|
||||
- protocol: TCP
|
||||
port: 443
|
||||
6
policies/kustomization.yaml
Normal file
6
policies/kustomization.yaml
Normal file
@@ -0,0 +1,6 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
resources:
|
||||
- external-policy.yaml
|
||||
- internal-policy.yaml
|
||||
Reference in New Issue
Block a user