Networking

VPC, subnets, internet gateways, route tables, NAT gateways, security groups, and VPC endpoints.

API Group: aws.konfig.io/v1alpha1

VPC # ✅ Working

Creates and manages a VPC with DNS settings, instance tenancy, optional IPv6 CIDR block, and secondary IPv4 CIDRs. Secondary CIDRs are reconciled on every sync — missing ones are added, removed ones are disassociated.

Spec

FieldTypeRequiredDescription
cidrBlockstringThe primary IPv4 CIDR block for the VPC (e.g. 10.0.0.0/16). Immutable after creation.
enableDnsSupportboolEnable DNS resolution in the VPC. Default: true.
enableDnsHostnamesboolAssign DNS hostnames to EC2 instances. Default: false.
instanceTenancystringTenancy of instances launched into the VPC. default or dedicated. Immutable after creation. Default: default.
assignIpv6CidrBlockboolRequest an Amazon-provided IPv6 /56 CIDR block for the VPC.
secondaryIPv4CIDRs[]stringAdditional IPv4 CIDR blocks to associate with the VPC. Delta sync — adds/removes as needed.
tagsmap[string]stringAWS tags applied to the VPC.

Status

FieldDescription
vpcIdThe ID of the created VPC (e.g. vpc-0abc123).
stateCurrent VPC state: pending or available.
ipv6CidrBlockThe Amazon-provided IPv6 CIDR block, if requested.
conditionsStandard Kubernetes conditions.
observedGenerationLast reconciled generation.
lastSyncTimeRFC3339 timestamp of last sync.

Example

yaml
apiVersion: aws.konfig.io/v1alpha1
kind: VPC
metadata:
  name: prod-vpc
  namespace: networking
spec:
  cidrBlock: 10.0.0.0/16
  enableDnsSupport: true
  enableDnsHostnames: true
  assignIpv6CidrBlock: true
  secondaryIPv4CIDRs:
    - 100.64.0.0/16
  tags:
    env: prod
    team: platform

Notes

  • cidrBlock is immutable after creation. To change it, delete and recreate the VPC (and all dependent resources).
  • instanceTenancy is immutable after creation.
  • secondaryIPv4CIDRs are reconciled on every sync — adding entries associates the CIDR, removing entries disassociates it from the VPC.

Deletion

Blocked if in use. AWS will refuse to delete a VPC that still has subnets, non-default security groups, route tables (other than the main table), or an attached internet gateway. Delete all dependent resources first.

Subnet # ✅ Working

Creates a subnet within a VPC. The controller waits for the referenced VPC CR to be Ready before creating the subnet.

Spec

FieldTypeRequiredDescription
vpcRef.namestringName of the VPC CR in the same namespace.
vpcRef.idstringDirect VPC ID (alternative to vpcRef.name).
cidrBlockstringIPv4 CIDR block for the subnet. Must be a subset of the VPC CIDR. Immutable after creation.
availabilityZonestringThe Availability Zone for the subnet (e.g. us-east-1a).
mapPublicIpOnLaunchboolAutomatically assign a public IPv4 address to instances launched in this subnet. Default: false.
tagsmap[string]stringAWS tags applied to the subnet.

Status

FieldDescription
subnetIdThe ID of the created subnet.
availableIpAddressCountThe number of available IPv4 addresses in the subnet.
conditionsStandard Kubernetes conditions.
observedGenerationLast reconciled generation.
lastSyncTimeRFC3339 timestamp of last sync.

Example

yaml
apiVersion: aws.konfig.io/v1alpha1
kind: Subnet
metadata:
  name: prod-public-subnet-1a
  namespace: networking
spec:
  vpcRef:
    name: prod-vpc
  cidrBlock: 10.0.1.0/24
  availabilityZone: us-east-1a
  mapPublicIpOnLaunch: true
  tags:
    env: prod
    type: public
    kubernetes.io/role/elb: "1"

Notes

  • cidrBlock is immutable after creation.
  • The controller waits for the VPC CR to be Ready before creating the subnet. If the VPC CR is not Ready, the subnet CR will have reason: DependencyNotReady.

Deletion

Blocked if in use. AWS will refuse to delete a subnet that has Elastic Network Interfaces (ENIs) attached — typically means EC2 instances, RDS instances, Lambda functions, or load balancers still using it.

InternetGateway # ✅ Working

Creates an Internet Gateway and attaches it to the referenced VPC. Only one IGW can be attached to a VPC at a time.

Spec

FieldTypeRequiredDescription
vpcRef.namestringName of the VPC CR to attach to.
vpcRef.idstringDirect VPC ID (alternative to vpcRef.name).
tagsmap[string]stringAWS tags applied to the internet gateway.

Status

FieldDescription
internetGatewayIdThe ID of the created internet gateway (e.g. igw-0abc123).
conditionsStandard Kubernetes conditions.
observedGenerationLast reconciled generation.
lastSyncTimeRFC3339 timestamp of last sync.

Example

yaml
apiVersion: aws.konfig.io/v1alpha1
kind: InternetGateway
metadata:
  name: prod-igw
  namespace: networking
spec:
  vpcRef:
    name: prod-vpc
  tags:
    env: prod

Notes

  • Maximum one internet gateway per VPC. Creating a second one while the first is attached will result in an error.
  • The controller handles both creation and attachment in the same reconcile loop.

Deletion

Immediate. The controller detaches the IGW from the VPC first, then deletes it.

RouteTable # ✅ Working

Route table with individual route management and subnet associations. Routes and subnet associations are diffed on every reconcile. The local route is never removed.

Spec

FieldTypeRequiredDescription
vpcRef.namestringName of the VPC CR.
vpcRef.idstringDirect VPC ID (alternative to vpcRef.name).
routes[]RouteList of routes. Each route has destinationCidr, and one of gatewayId, natGatewayRef.
routes[].destinationCidrstringDestination CIDR block for the route (e.g. 0.0.0.0/0).
routes[].gatewayIdstringDirect gateway ID (IGW, VGW, etc.). Mutually exclusive with natGatewayRef.
routes[].natGatewayRefstringName of a NatGateway CR. Controller waits for NatGateway to be Ready.
subnetAssociations[]stringNames of Subnet CRs to associate with this route table. Delta sync.
tagsmap[string]stringAWS tags applied to the route table.

Status

FieldDescription
routeTableIdThe ID of the route table.
conditionsStandard Kubernetes conditions.
observedGenerationLast reconciled generation.
lastSyncTimeRFC3339 timestamp of last sync.

Example

yaml
apiVersion: aws.konfig.io/v1alpha1
kind: RouteTable
metadata:
  name: prod-public-rt
  namespace: networking
spec:
  vpcRef:
    name: prod-vpc
  routes:
    - destinationCidr: 0.0.0.0/0
      gatewayId: igw-0abc123   # or use InternetGateway CR name via ref
  subnetAssociations:
    - prod-public-subnet-1a
    - prod-public-subnet-1b
  tags:
    env: prod
    type: public
---
apiVersion: aws.konfig.io/v1alpha1
kind: RouteTable
metadata:
  name: prod-private-rt-1a
  namespace: networking
spec:
  vpcRef:
    name: prod-vpc
  routes:
    - destinationCidr: 0.0.0.0/0
      natGatewayRef: prod-nat-1a   # references NatGateway CR
  subnetAssociations:
    - prod-private-subnet-1a
  tags:
    env: prod
    type: private

Notes

  • Routes are diffed on every reconcile — routes in AWS not in spec are deleted; routes in spec not in AWS are created.
  • The local route (VPC CIDR → local) is always preserved and never deleted, even if not specified in spec.
  • Subnet associations are delta-synced: the controller associates subnets in spec not yet associated, and disassociates subnets removed from spec.
  • When using natGatewayRef, the controller waits for the NatGateway CR to be Ready before creating the route.

Deletion

Immediate. The controller disassociates all subnets first, then deletes the route table. If this is the main route table of a VPC, deletion is a no-op (AWS does not allow deletion of the main route table).

NatGateway # ✅ Working ⏱ async

Creates a NAT gateway in the specified subnet. Public NAT gateways automatically allocate an Elastic IP address. Provisioning takes 1–3 minutes.

⏱ Async — takes 1–3 minutes to provision. Controller polls every 15 seconds until the NAT gateway reaches the available state.

Spec

FieldTypeRequiredDescription
subnetRef.namestringName of the Subnet CR to place the NAT gateway in (must be a public subnet for public NAT).
subnetRef.idstringDirect subnet ID (alternative to subnetRef.name).
connectivityTypestringpublic or private. Default: public. Public NAT gateways allocate an EIP; private ones do not. Immutable after creation.
tagsmap[string]stringAWS tags applied to the NAT gateway.

Status

FieldDescription
natGatewayIdThe ID of the NAT gateway (e.g. nat-0abc123).
elasticIpAllocationIdThe Elastic IP allocation ID (public NAT gateways only).
stateCurrent state: pending, available, deleting, deleted.
conditionsStandard Kubernetes conditions.
observedGenerationLast reconciled generation.
lastSyncTimeRFC3339 timestamp of last sync.

Example

yaml
apiVersion: aws.konfig.io/v1alpha1
kind: NatGateway
metadata:
  name: prod-nat-1a
  namespace: networking
spec:
  subnetRef:
    name: prod-public-subnet-1a
  connectivityType: public
  tags:
    env: prod
    az: us-east-1a

Notes

  • Public NAT gateways allocate a new Elastic IP address automatically. The EIP allocation ID is stored in status.elasticIpAllocationId.
  • Private NAT gateways do not allocate an EIP and are used for routing between private subnets.
  • connectivityType is immutable after creation.

Deletion

Async (~60–90 seconds). The controller initiates deletion and polls until the NAT gateway reaches the deleted state, then releases the associated Elastic IP address. The CR remains until AWS confirms full deletion.

SecurityGroup # ✅ Working

Creates a security group with ingress and egress rules. Rules support IPv4 CIDR, IPv6 CIDR, prefix lists, and references to other security groups — all with per-rule descriptions. Drift detection runs on every reconcile.

Spec

FieldTypeRequiredDescription
vpcRef.namestringName of the VPC CR.
vpcRef.idstringDirect VPC ID (alternative to vpcRef.name).
groupNamestringName of the security group. Immutable after creation.
descriptionstringDescription of the security group. Immutable after creation.
ingressRules[]SGRuleList of ingress rules.
egressRules[]SGRuleList of egress rules. Default: allow all outbound (0.0.0.0/0, -1).
tagsmap[string]stringAWS tags applied to the security group.

Each SGRule in ingressRules / egressRules supports:

FieldTypeDescription
protocolstringIP protocol: tcp, udp, icmp, icmpv6, or -1 (all).
fromPortint32Start of port range. Use -1 for ICMP or all protocols.
toPortint32End of port range.
cidrIpv4stringIPv4 CIDR block source/destination.
cidrIpv6stringIPv6 CIDR block source/destination.
prefixListIdstringAWS-managed prefix list ID (e.g. for S3 or DynamoDB gateway endpoints).
sourceGroupRefstringName of another SecurityGroup CR in the same namespace.
descriptionstringPer-rule description for auditing purposes.

Status

FieldDescription
groupIdThe ID of the security group (e.g. sg-0abc123).
conditionsStandard Kubernetes conditions.
observedGenerationLast reconciled generation.
lastSyncTimeRFC3339 timestamp of last sync.

Example — Web Security Group

yaml
apiVersion: aws.konfig.io/v1alpha1
kind: SecurityGroup
metadata:
  name: web-sg
  namespace: networking
spec:
  vpcRef:
    name: prod-vpc
  groupName: web-sg
  description: "Web tier security group"
  ingressRules:
    - protocol: tcp
      fromPort: 443
      toPort: 443
      cidrIpv4: 0.0.0.0/0
      description: "HTTPS from internet"
    - protocol: tcp
      fromPort: 443
      toPort: 443
      cidrIpv6: "::/0"
      description: "HTTPS from internet (IPv6)"
    - protocol: tcp
      fromPort: 80
      toPort: 80
      cidrIpv4: 0.0.0.0/0
      description: "HTTP redirect"
  egressRules:
    - protocol: "-1"
      fromPort: -1
      toPort: -1
      cidrIpv4: 0.0.0.0/0
      description: "All outbound"
  tags:
    env: prod
    tier: web

Example — DB Security Group (SG reference)

yaml
apiVersion: aws.konfig.io/v1alpha1
kind: SecurityGroup
metadata:
  name: db-sg
  namespace: networking
spec:
  vpcRef:
    name: prod-vpc
  groupName: db-sg
  description: "Database tier security group"
  ingressRules:
    - protocol: tcp
      fromPort: 5432
      toPort: 5432
      sourceGroupRef: web-sg    # references SecurityGroup CR
      description: "PostgreSQL from web tier"
  tags:
    env: prod
    tier: db

Notes

  • groupName and description are immutable after creation.
  • All rules are diffed on every reconcile cycle. Rules present in AWS but not in spec are deleted; rules in spec but not in AWS are created.
  • When using sourceGroupRef, the controller waits for the referenced security group CR to be Ready.

Deletion

Blocked if in use. AWS refuses to delete a security group that is currently attached to ENIs, RDS instances, Lambda functions, or referenced as a source/destination in another security group's rules.

VPCEndpoint # ✅ Working

Creates Interface or Gateway VPC endpoints for AWS services. Gateway endpoints (S3, DynamoDB) are free; Interface endpoints are billed per hour and per GB.

Spec

FieldTypeRequiredDescription
vpcRef.namestringName of the VPC CR.
vpcRef.idstringDirect VPC ID.
serviceNamestringAWS service name in the format com.amazonaws.<region>.<service> (e.g. com.amazonaws.us-east-1.s3).
endpointTypestringInterface or Gateway.
routeTableRefs[]stringNames of RouteTable CRs to associate (Gateway endpoints only).
subnetRefs[]stringNames of Subnet CRs to place the endpoint ENIs in (Interface endpoints only).
securityGroupRefs[]stringNames of SecurityGroup CRs for the endpoint ENIs (Interface endpoints only).
tagsmap[string]stringAWS tags applied to the endpoint.

Status

FieldDescription
endpointIdThe ID of the VPC endpoint (e.g. vpce-0abc123).
stateCurrent endpoint state: pending, available, deleting, etc.
conditionsStandard Kubernetes conditions.
observedGenerationLast reconciled generation.
lastSyncTimeRFC3339 timestamp of last sync.

Example — S3 Gateway Endpoint

yaml
apiVersion: aws.konfig.io/v1alpha1
kind: VPCEndpoint
metadata:
  name: s3-gateway-endpoint
  namespace: networking
spec:
  vpcRef:
    name: prod-vpc
  serviceName: com.amazonaws.us-east-1.s3
  endpointType: Gateway
  routeTableRefs:
    - prod-private-rt-1a
    - prod-private-rt-1b
  tags:
    env: prod
---
apiVersion: aws.konfig.io/v1alpha1
kind: VPCEndpoint
metadata:
  name: ecr-api-endpoint
  namespace: networking
spec:
  vpcRef:
    name: prod-vpc
  serviceName: com.amazonaws.us-east-1.ecr.api
  endpointType: Interface
  subnetRefs:
    - prod-private-subnet-1a
    - prod-private-subnet-1b
  securityGroupRefs:
    - web-sg
  tags:
    env: prod

Notes

  • Gateway endpoints (S3, DynamoDB) are free and add a route to the specified route tables. No ENIs are created.
  • Interface endpoints create ENIs in the specified subnets and are billed per hour and per GB of data processed.
  • The service name format is always com.amazonaws.<region>.<service>. Run aws ec2 describe-vpc-endpoint-services to discover available services in your region.

Deletion

Immediate. The VPC endpoint is deleted. Route table entries for Gateway endpoints are removed automatically by AWS.