Skip to content

Instantly share code, notes, and snippets.

@csokun
Created January 15, 2024 01:43
Show Gist options
  • Save csokun/0a2b6463348f42878e32fc4b22f7972c to your computer and use it in GitHub Desktop.
Save csokun/0a2b6463348f42878e32fc4b22f7972c to your computer and use it in GitHub Desktop.
EKS ALB Controller actions & conditions
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 2 # tells deployment to run 2 pods matching the template
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
name: nginx-svc
spec:
type: NodePort
ports:
- name: http
protocol: TCP
port: 80
targetPort: 80
selector:
app: nginx
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: nginx-ingress
annotations:
alb.ingress.kubernetes.io/scheme: "internet-facing"
alb.ingress.kubernetes.io/listen-ports: '[{"HTTPS":443}]'
alb.ingress.kubernetes.io/actions.nginx-svc: >
{"type":"forward","forwardConfig":{"targetGroups":[{"serviceName":"nginx-svc","servicePort":"80","weight":100}],"targetGroupStickinessConfig":{"enabled":true,"durationSeconds":200}}}
alb.ingress.kubernetes.io/conditions.nginx-svc: >
[{"field":"http-header","httpHeaderConfig":{"httpHeaderName": "X-TOKEN", "values":["my-token-me"]}}]
spec:
ingressClassName: alb
rules:
- host: nginx-demo.example.com
http:
paths:
- path: /*
pathType: ImplementationSpecific
backend:
service:
name: nginx-svc
port:
name: use-annotation
tls:
- hosts:
- nginx-demo.example.com
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment