Skip to content

Instantly share code, notes, and snippets.

@gugahoi
Last active June 30, 2017 03:19
Show Gist options
  • Save gugahoi/9f6fbb497899a1a4bca0973be0aad88d to your computer and use it in GitHub Desktop.
Save gugahoi/9f6fbb497899a1a4bca0973be0aad88d to your computer and use it in GitHub Desktop.
Kubernetes Ingress Controller Configuration
apiVersion: v1
kind: Service
metadata:
name: echoheaders
labels:
app: echoheaders
spec:
type: NodePort
ports:
- port: 80
targetPort: 8080
protocol: TCP
name: http
selector:
app: echoheaders
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: echoheaders
spec:
replicas: 1
template:
metadata:
labels:
app: echoheaders
spec:
containers:
- name: echoheaders
image: gcr.io/google_containers/echoserver:1.4
ports:
- containerPort: 8080
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: echoheaders-nginx
annotations:
kubernetes.io/ingress.class: nginx
spec:
rules:
- host: echoheaders-nginx.kubernetes.XXX.com
http:
paths:
- backend:
serviceName: echoheaders
servicePort: 80
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: echoheaders-traefik
annotations:
kubernetes.io/ingress.class: traefik
spec:
rules:
- host: echoheaders-traefik.kubernetes.XXX.com
http:
paths:
- backend:
serviceName: echoheaders
servicePort: 80
[general]
url = http://echoheaders-nginx.kubernetes.XXX.com
timeout = 100
concurrency = 10
requests = 1000
timelimit = 100
json-output = test-result.json
method = GET
body = Hello world
[regions]
us-east-1 ;N.Virginia
#us-east-2 ;Ohio
#us-west-1 ;N.California
#us-west-2 ;Oregon
#eu-west-1 ;Ireland
#eu-central-1 ;Frankfurt
#ap-southeast-1
ap-southeast-2
#ap-northeast-1 ;Sydney
#ap-northeast-2 ;Seoul
#sa-east-1 ;Sao Paulo
[headers]
cache-control: no-cache
#auth-token: YOUR-SECRET-AUTH-TOKEN
[general]
url = http://echoheaders-traefik.kubernetes.XXX.com
timeout = 100
concurrency = 10
requests = 1000
timelimit = 100
json-output = test-result.json
method = GET
body = Hello world
[regions]
us-east-1 ;N.Virginia
#us-east-2 ;Ohio
#us-west-1 ;N.California
#us-west-2 ;Oregon
#eu-west-1 ;Ireland
#eu-central-1 ;Frankfurt
#ap-southeast-1
ap-southeast-2
#ap-northeast-1 ;Sydney
#ap-northeast-2 ;Seoul
#sa-east-1 ;Sao Paulo
[headers]
cache-control: no-cache
#auth-token: YOUR-SECRET-AUTH-TOKEN
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: ingress-nginx
namespace: kube-system
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: ingress-nginx
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["*"]
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: ingress-nginx
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: ingress-nginx
subjects:
- kind: ServiceAccount
name: ingress-nginx
namespace: kube-system
---
kind: Service
apiVersion: v1
metadata:
name: nginx-default-backend
namespace: kube-system
labels:
k8s-addon: ingress-nginx.addons.k8s.io
spec:
ports:
- port: 80
targetPort: http
selector:
app: nginx-default-backend
---
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: nginx-default-backend
namespace: kube-system
labels:
k8s-addon: ingress-nginx.addons.k8s.io
spec:
replicas: 1
template:
metadata:
labels:
k8s-addon: ingress-nginx.addons.k8s.io
app: nginx-default-backend
spec:
terminationGracePeriodSeconds: 60
containers:
- name: default-http-backend
image: gcr.io/google_containers/defaultbackend:1.0
livenessProbe:
httpGet:
path: /healthz
port: 8080
scheme: HTTP
initialDelaySeconds: 30
timeoutSeconds: 5
resources:
limits:
cpu: 10m
memory: 20Mi
requests:
cpu: 10m
memory: 20Mi
ports:
- name: http
containerPort: 8080
protocol: TCP
---
kind: ConfigMap
apiVersion: v1
metadata:
name: ingress-nginx
namespace: kube-system
labels:
k8s-addon: ingress-nginx.addons.k8s.io
data:
use-proxy-protocol: "true"
---
kind: Service
apiVersion: v1
metadata:
name: ingress-nginx
namespace: kube-system
labels:
k8s-addon: ingress-nginx.addons.k8s.io
annotations:
service.beta.kubernetes.io/aws-load-balancer-proxy-protocol: '*'
spec:
type: LoadBalancer
selector:
app: ingress-nginx
ports:
- name: http
port: 80
targetPort: http
- name: https
port: 443
targetPort: https
---
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: ingress-nginx
namespace: kube-system
labels:
k8s-addon: ingress-nginx.addons.k8s.io
spec:
replicas: 1
template:
metadata:
labels:
app: ingress-nginx
k8s-addon: ingress-nginx.addons.k8s.io
spec:
terminationGracePeriodSeconds: 60
serviceAccount: ingress-nginx
containers:
- image: gcr.io/google_containers/nginx-ingress-controller:0.9.0-beta.8
name: ingress-nginx
imagePullPolicy: Always
ports:
- name: http
containerPort: 80
protocol: TCP
- name: https
containerPort: 443
protocol: TCP
livenessProbe:
httpGet:
path: /healthz
port: 10254
scheme: HTTP
initialDelaySeconds: 30
timeoutSeconds: 5
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
args:
- /nginx-ingress-controller
- --default-backend-service=$(POD_NAMESPACE)/nginx-default-backend
- --configmap=$(POD_NAMESPACE)/ingress-nginx
- --publish-service=$(POD_NAMESPACE)/ingress-nginx
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: traefik-ingress-controller
rules:
- apiGroups:
- "*"
resources:
- "*"
verbs:
- "*"
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1beta1
metadata:
name: traefik-ingress-controller
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: traefik-ingress-controller
subjects:
- kind: ServiceAccount
name: traefik-ingress-controller
namespace: kube-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: traefik-ingress-controller
namespace: kube-system
---
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: traefik-ingress-controller
namespace: kube-system
labels:
k8s-app: traefik-ingress-lb
spec:
replicas: 1
selector:
matchLabels:
k8s-app: traefik-ingress-lb
template:
metadata:
labels:
k8s-app: traefik-ingress-lb
name: traefik-ingress-lb
spec:
serviceAccountName: traefik-ingress-controller
terminationGracePeriodSeconds: 60
containers:
- image: traefik:v1.3.2
name: traefik-ingress-lb
resources:
limits:
cpu: 200m
memory: 30Mi
requests:
cpu: 100m
memory: 20Mi
ports:
- containerPort: 80
- containerPort: 8080
args:
- --configfile=/config/traefik.toml
- --kubernetes
---
apiVersion: v1
kind: Service
metadata:
namespace: kube-system
name: traefik
labels:
k8s-app: traefik-ingress-lb
spec:
selector:
k8s-app: traefik-ingress-lb
ports:
- port: 80
name: http
type: LoadBalancer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment