Skip to content

Commit

Permalink
ingress demo
Browse files Browse the repository at this point in the history
  • Loading branch information
wardviaene committed Nov 23, 2016
1 parent 5a86a34 commit f01f6e9
Show file tree
Hide file tree
Showing 5 changed files with 169 additions and 0 deletions.
33 changes: 33 additions & 0 deletions ingress/echoservice.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: echoheaders
spec:
replicas: 1
template:
metadata:
labels:
app: echoheaders
spec:
containers:
- name: echoheaders
image: gcr.io/google_containers/echoserver:1.0
ports:
- containerPort: 8080
---
apiVersion: v1
kind: Service
metadata:
name: echoheaders-default
labels:
app: echoheaders
spec:
type: NodePort
ports:
- port: 80
nodePort: 30302
targetPort: 8080
protocol: TCP
name: http
selector:
app: echoheaders
32 changes: 32 additions & 0 deletions ingress/helloworld-v1.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: helloworld-v1-deployment
spec:
replicas: 1
template:
metadata:
labels:
app: helloworld-v1
spec:
containers:
- name: k8s-demo
image: wardviaene/k8s-demo:latest
ports:
- name: nodejs-port
containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
name: helloworld-v1
spec:
type: NodePort
ports:
- port: 80
nodePort: 30303
targetPort: 3000
protocol: TCP
name: http
selector:
app: helloworld-v1
32 changes: 32 additions & 0 deletions ingress/helloworld-v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: helloworld-v2-deployment
spec:
replicas: 1
template:
metadata:
labels:
app: helloworld-v2
spec:
containers:
- name: k8s-demo
image: wardviaene/k8s-demo:2
ports:
- name: nodejs-port
containerPort: 3000
---
apiVersion: v1
kind: Service
metadata:
name: helloworld-v2
spec:
type: NodePort
ports:
- port: 80
nodePort: 30304
targetPort: 3000
protocol: TCP
name: http
selector:
app: helloworld-v2
21 changes: 21 additions & 0 deletions ingress/ingress.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# An Ingress with 2 hosts and 3 endpoints
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: helloworld-rules
spec:
rules:
- host: helloworld-v1.example.com
http:
paths:
- path: /
backend:
serviceName: helloworld-v1
servicePort: 80
- host: helloworld-v2.example.com
http:
paths:
- path: /
backend:
serviceName: helloworld-v2
servicePort: 80
51 changes: 51 additions & 0 deletions ingress/nginx-ingress-controller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
apiVersion: v1
kind: ReplicationController
metadata:
name: nginx-ingress-controller
labels:
k8s-app: nginx-ingress-lb
spec:
replicas: 1
selector:
k8s-app: nginx-ingress-lb
template:
metadata:
labels:
k8s-app: nginx-ingress-lb
name: nginx-ingress-lb
spec:
terminationGracePeriodSeconds: 60
containers:
- image: gcr.io/google_containers/nginx-ingress-controller:0.8.3
name: nginx-ingress-lb
imagePullPolicy: Always
readinessProbe:
httpGet:
path: /healthz
port: 10254
scheme: HTTP
livenessProbe:
httpGet:
path: /healthz
port: 10254
scheme: HTTP
initialDelaySeconds: 10
timeoutSeconds: 1
# use downward API
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
ports:
- containerPort: 80
hostPort: 80
- containerPort: 443
hostPort: 443
args:
- /nginx-ingress-controller
- --default-backend-service=$(POD_NAMESPACE)/echoheaders-default

0 comments on commit f01f6e9

Please sign in to comment.