Created
May 6, 2018 15:06
-
-
Save patientplatypus/fa07648339ee6538616cb69282a84938 to your computer and use it in GitHub Desktop.
Kubernetes Yaml File for Ingress Play
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: apps/v1beta1 | |
kind: Deployment | |
metadata: | |
name: frontend | |
labels: | |
app: frontend | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: | |
app: frontend | |
template: | |
metadata: | |
labels: | |
app: frontend | |
spec: | |
containers: | |
- name: nginx | |
image: patientplatypus/frontend_example | |
ports: | |
- containerPort: 3000 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: frontend | |
spec: | |
type: LoadBalancer | |
selector: | |
app: frontend | |
ports: | |
- protocol: TCP | |
port: 80 | |
targetPort: 3000 | |
--- | |
apiVersion: apps/v1beta1 | |
kind: Deployment | |
metadata: | |
name: backend | |
labels: | |
app: backend | |
spec: | |
replicas: 3 | |
selector: | |
matchLabels: | |
app: backend | |
template: | |
metadata: | |
labels: | |
app: backend | |
spec: | |
containers: | |
- name: nginx | |
image: patientplatypus/backend_example | |
ports: | |
- containerPort: 5000 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: backend | |
spec: | |
type: LoadBalancer | |
selector: | |
app: backend | |
ports: | |
- protocol: TCP | |
port: 80 | |
targetPort: 5000 | |
--- | |
apiVersion: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: ingress | |
spec: | |
rules: | |
- host: www.kubeplaytime.example | |
http: | |
paths: | |
- path: / | |
backend: | |
serviceName: frontend | |
servicePort: 80 | |
- path: /api | |
backend: | |
serviceName: backend | |
servicePort: 80 | |
--- | |
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: ingress-nginx | |
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 | |
spec: | |
replicas: 1 | |
template: | |
metadata: | |
labels: | |
app: ingress-nginx | |
spec: | |
terminationGracePeriodSeconds: 60 | |
containers: | |
- image: gcr.io/google_containers/nginx-ingress-controller:0.8.3 | |
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 | |
--- | |
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: nginx-default-backend | |
spec: | |
ports: | |
- port: 80 | |
targetPort: http | |
selector: | |
app: nginx-default-backend | |
--- | |
kind: Deployment | |
apiVersion: extensions/v1beta1 | |
metadata: | |
name: nginx-default-backend | |
spec: | |
replicas: 1 | |
template: | |
metadata: | |
labels: | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment