In a multi-service system like InventarioITU, every pod that Kubernetes schedules can — by default — send traffic to every other pod in the cluster. That default-open posture means a compromised frontend container could directly query the SQL Server port, or a rogue sidecar could exfiltrate MongoDB records, without any network-level obstacle. KubernetesDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/carlamndz/InventarioITU/llms.txt
Use this file to discover all available pages before exploring further.
NetworkPolicy objects close this gap by declaring an explicit allowlist of permitted pod-to-pod flows and dropping everything else. InventarioITU uses Calico as its CNI plugin specifically because Calico enforces these policies at the Linux kernel level via eBPF and iptables — something the default Minikube CNI cannot do.
Calico CNI Setup in Minikube
Calico is installed automatically when Minikube is started with the--cni=calico flag (see the Kubernetes deployment guide). Once running, Calico deploys two key components into the kube-system namespace:
- calico-node — a DaemonSet pod that runs on every node and programs the kernel’s networking rules based on active
NetworkPolicyobjects. - calico-kube-controllers — a Deployment pod that watches the Kubernetes API for policy changes and keeps Calico’s internal datastore in sync.
NetworkPolicy resources. InventarioITU’s policies use only the core networking.k8s.io/v1 API, so they are portable to any other CNI that enforces the spec (Cilium, Weave, Antrea, etc.).
Policy Design
The security model is simple: onlyinventario-web may initiate connections to the backend services. All other pods — including future workloads added to the cluster — are denied access to the database and LDAP ports. This is enforced by attaching an Ingress NetworkPolicy to each backend service and limiting allowed sources to pods labeled app: inventario-web.
| Source | Destination | Port | Allowed |
|---|---|---|---|
| inventario-web | ubicacion-db | 1433 | ✅ Yes |
| inventario-web | inventario-db | 27017 | ✅ Yes |
| inventario-web | ldap-service | 389 | ✅ Yes |
| Any other pod | ubicacion-db | 1433 | ❌ No |
| Any other pod | inventario-db | 27017 | ❌ No |
| Any other pod | ldap-service | 389 | ❌ No |
NetworkPolicy with policyTypes: [Ingress] is applied to a pod, Kubernetes switches that pod from default-allow to default-deny for inbound traffic. Only the ingress rules explicitly listed in the policy are permitted — all other inbound connections are silently dropped.
Example NetworkPolicy: SQL Server
The following manifest restricts inbound traffic to theubicacion-db (SQL Server) pod. Any pod in the cluster that is not labeled app: inventario-web will have its connection to port 1433 dropped by Calico before it reaches the SQL Server process.
app: inventario-db) and OpenLDAP (port 389, target label app: ldap-service). Save all three policy manifests to k8s/network-policies/ — once you do, they will be applied automatically when you run kubectl apply -f k8s/.
Host-Level Firewall with GUFW
Kubernetes NetworkPolicies govern pod-to-pod traffic inside the cluster. They do not protect the host node from external network access. On the Minikube host (and on any bare-metal or VM nodes in a physical cluster), the GUFW (Graphical Uncomplicated Firewall) layer provides an additional defense-in-depth boundary. GUFW is a front-end forufw (Uncomplicated Firewall) on Ubuntu/Debian-based Linux systems. It protects against:
- Direct external connections to database ports that were inadvertently exposed on the host network interface (e.g., via
NodePortorhostPortbindings). - Reconnaissance and brute-force attempts against LDAP from outside the local network.
Recommended Host Firewall Rules
The followingufw rules deny inbound connections to the three sensitive ports from any source outside the local cluster subnet. Adjust <cluster-subnet> to your Minikube node IP range (typically 192.168.49.0/24).
gufw from a desktop session) provides the same controls with a visual rule list, which is useful for auditing the firewall state at a glance.