|  | 
|  | 1 | +# NPEP-133: FQDN Selector for Egress Traffic | 
|  | 2 | + | 
|  | 3 | +* Issue: | 
|  | 4 | +  [#133](https://github.com/kubernetes-sigs/network-policy-api/issues/133) | 
|  | 5 | +* Status: Provisional | 
|  | 6 | + | 
|  | 7 | +## TLDR | 
|  | 8 | + | 
|  | 9 | +This enhancement proposes adding a new selector to specify egress peers using | 
|  | 10 | +Fully Qualified Domain Names (FQDNs).  | 
|  | 11 | + | 
|  | 12 | +## Goals | 
|  | 13 | + | 
|  | 14 | +* Provide a selector to specify egress peers using a Fully Qualified Domain Name | 
|  | 15 | +  (for example `kubernetes.io`). | 
|  | 16 | +* Support a restricted set of regex matching capabilities when specifying FQDNs.  | 
|  | 17 | + | 
|  | 18 | +## Non-Goals | 
|  | 19 | + | 
|  | 20 | +* This enhancement does not include a FQDN selector for allowing ingress | 
|  | 21 | +  traffic. | 
|  | 22 | +* This enhancement does not include any L7 matching or filtering capabilities, | 
|  | 23 | +  like matching HTTP traffic or URL paths. | 
|  | 24 | +    * This selector should not control what DNS records are resolvable from a | 
|  | 25 | +      particular workload. | 
|  | 26 | +* This enhancement does not provide a mechanism for selecting in-cluster | 
|  | 27 | +  endpoints using FQDNs. This is explicitly disallowed by the spec. | 
|  | 28 | +    * To select Pods, Nodes, API Server, AdminNetworkPolicy has more first party | 
|  | 29 | +      selector with better UX. | 
|  | 30 | +* This enhancement does not specify the details of how traffic is routed to the | 
|  | 31 | +  specified destination. For example, it does not prescribe details around NAT | 
|  | 32 | +  or egress gateways. | 
|  | 33 | +* This enhancement does not require a particular mechanism for securing DNS | 
|  | 34 | +  resolution (e.g. DNSSEC or DNS-over-TLS). | 
|  | 35 | +    * TODO: Is this up to implementations? Maybe an optional enum describing | 
|  | 36 | +      what security mechanims to use and providers can chose whther to support | 
|  | 37 | +      or not. | 
|  | 38 | + | 
|  | 39 | +## Introduction | 
|  | 40 | + | 
|  | 41 | +FQDN-based egress controls are a common enterprise security practice. | 
|  | 42 | +Administrators often prefer to write security policies using DNS names such as | 
|  | 43 | +“www.kubernetes.io” instead of capturing all the IP addresses the DNS name might | 
|  | 44 | +resolve to. Keeping up with changing IP addresses is a maintenance burden, and | 
|  | 45 | +hampers the readability of the network policies. | 
|  | 46 | + | 
|  | 47 | +## User Stories | 
|  | 48 | + | 
|  | 49 | +* As a cluster admin, I want to allow certain workloads to send traffic to a | 
|  | 50 | +  service specified by a well-known domain name (e.g. on-prem logging service) | 
|  | 51 | +* As a cluster admin, I want to allow the cluster to communitcate with services | 
|  | 52 | +  provided by a Cloud provider by allowing their whole domain. | 
|  | 53 | + | 
|  | 54 | +## API | 
|  | 55 | + | 
|  | 56 | +TODO | 
|  | 57 | + | 
|  | 58 | +## Alternatives | 
|  | 59 | + | 
|  | 60 | +### IP Block Selector | 
|  | 61 | + | 
|  | 62 | +IP blocks are an important tool for specifying Network Policies. However, they | 
|  | 63 | +do not address all user needs and have a few short-comings when compared to FQDN | 
|  | 64 | +selectors: | 
|  | 65 | + | 
|  | 66 | +* IP-based selectors can become verbose if a single logical service has numerous | 
|  | 67 | +  IPs backing it. | 
|  | 68 | +* IP-based selectors pose an ongoing maintanance burden for administrators, who | 
|  | 69 | +  need to be aware of changing IPs. | 
|  | 70 | +* IP-based selectors can result in policies that are difficult to read and | 
|  | 71 | +  audit. | 
|  | 72 | + | 
|  | 73 | +### L7 Policy | 
|  | 74 | + | 
|  | 75 | +Another alternative is to provide a true L7 selector, similar to the policies | 
|  | 76 | +provided by Service Mesh providers. While L7 selectors can offer more | 
|  | 77 | +expressibility, they often come trade-offs that are not suitable for all users: | 
|  | 78 | + | 
|  | 79 | +* L7 selectors necessarily support a select set of protocols. Customers may be | 
|  | 80 | +  using a custom protocol for application-level communication, but still want | 
|  | 81 | +  the ability to specify endpoints using DNS. | 
|  | 82 | +* L7 selectors often require proxies to perform deep packet inspection and | 
|  | 83 | +  enforce the policies. These proxies can introduce un-desireable latencies in | 
|  | 84 | +  the datapath of applications. | 
|  | 85 | + | 
|  | 86 | +## References | 
|  | 87 | + | 
|  | 88 | +* [NPEP #126](https://github.com/kubernetes-sigs/network-policy-api/issues/126): | 
|  | 89 | +  Egress Control in ANP | 
0 commit comments