Cilium L7 Network Segmentation Policy Prompt
Design Cilium L3/L4/L7 network policies to enforce least-privilege east-west traffic, including HTTP-method and DNS-aware rules and default-deny baselines.
- Target user
- Kubernetes networking and security engineers using Cilium
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior Kubernetes networking engineer who designs identity-based, least-privilege segmentation with Cilium's L3-L7 policy engine. I will provide: - Our service topology, namespaces, and the intended communication matrix - Current Cilium version, whether Hubble is enabled, and any existing policies - External dependencies (DNS names, egress targets, ingress sources) Your job: 1. **Observe first** — recommend using Hubble flow data to build an accurate allow-list from real traffic before enforcing, avoiding guesswork that breaks services. 2. **Default deny** — establish a per-namespace default-deny baseline for ingress and egress, then layer explicit allows. 3. **L3/L4 policies** — author CiliumNetworkPolicies using endpoint selectors and identities (not brittle IPs) for pod-to-pod allows. 4. **L7 rules** — add HTTP method/path restrictions and Kafka/gRPC rules where warranted, plus DNS-aware egress (toFQDNs) instead of wide CIDR allows. 5. **Cluster egress** — lock down outbound to approved FQDNs and block metadata/SSRF targets. 6. **Rollout & validation** — use audit/monitor mode, validate with Hubble, and stage namespace by namespace. Output as: (a) the communication matrix as policy intent, (b) CiliumNetworkPolicy YAML with L3/L4 and L7 examples, (c) toFQDNs egress rules, (d) a monitor-then-enforce rollout plan. Start in audit mode and verify with Hubble before enforcing; an over-tight default-deny can sever critical traffic.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Kubernetes Secret Encryption-at-Rest with KMS Prompt
Design encryption at rest for Kubernetes Secrets in etcd using a KMS provider, with envelope encryption, key rotation, and verification that existing secrets get re-encrypted.
-
Kubernetes NetworkPolicy Authoring & Review Prompt
Move a Kubernetes cluster from flat, open pod networking to default-deny, least-privilege NetworkPolicies — author, review, and validate ingress/egress rules per workload without breaking traffic.
-
Ansible Playbook & Vault Security Review Prompt
Review Ansible playbooks and roles for plaintext secrets, unsafe privilege escalation, and host-key/command-injection risks, and produce a hardened Vault, become, and templating configuration.
-
Consul ACL & Gossip Encryption Hardening Review Prompt
Review a HashiCorp Consul cluster for open ACLs, unencrypted gossip and RPC, and over-broad tokens, and produce a hardened default-deny ACL, TLS, and encryption configuration.
More DevOps Security & Hardening prompts & error guides
Browse every DevOps Security & Hardening prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.