Created
November 4, 2016 18:03
-
-
Save unya/148dcb1946248d47c519a0702205a243 to your computer and use it in GitHub Desktop.
Example web application composed of multiple services, pods, and containers
This file contains hidden or 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: extensions/v1beta1 | |
kind: Deployment | |
metadata: | |
name: example | |
spec: | |
replicas: 2 | |
selector: | |
matchLabels: | |
app: example | |
template: | |
metadata: | |
name: example | |
labels: | |
app: example | |
version: "1" | |
spec: | |
volumes: | |
- name: cloudsql-oauth-credentials | |
secret: | |
secretName: cloudsql-oauth-credentials | |
- name: ssl-certs | |
hostPath: | |
path: /etc/ssl/certs | |
- name: cloudsql | |
containers: | |
- name: sql-proxy | |
image: b.gcr.io/cloudsql-docker/gce-proxy:latest | |
imagePullPolicy: Always | |
volumeMounts: | |
- name: cloudsql-oauth-credentials | |
mountPath: /secrets/cloudsql | |
readOnly: true | |
- name: ssl-certs | |
mountPath: /etc/ssl/certs | |
- name: cloudsql | |
mountPath: /cloudsql | |
args: | |
- /cloud_sql_proxy | |
- --instances=usp-sites:europe-west1:sql-small-low=tcp:3306 | |
- -credential_file=/secrets/cloudsql/credentials.json | |
- name: example | |
image: examples/sites/example.pl:v0.0.14 | |
imagePullPolicy: Always | |
ports: | |
- containerPort: 80 | |
env: | |
- name: DB_USER | |
value: example | |
- name: DB_PASSWORD | |
value: "" | |
- name: DB_NAME | |
value: example | |
volumeMounts: | |
- name: cloudsql | |
mountPath: /cloudsql | |
- name: redirector | |
image: examples/redirector:v0.8 | |
imagePullPolicy: Always | |
ports: | |
- containerPort: 81 | |
env: | |
- name: REDIRECT_TO | |
value: www.example.pl |
This file contains hidden or 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
--- | |
kind: Deployment | |
apiVersion: extensions/v1beta1 | |
metadata: | |
name: example-pro | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: example-pro | |
template: | |
metadata: | |
name: example-pro | |
labels: | |
app: example-pro | |
usp-subsite: pro | |
spec: | |
containers: | |
- name: example-pro | |
image: examples/sites/example.pl-pro.pl:v0.6 | |
imagePullPolicy: Always | |
ports: | |
- containerPort: 80 | |
- name: echo | |
image: gcr.io/google_containers/echoserver:1.4 | |
ports: | |
- containerPort: 8080 | |
resources: | |
requests: | |
cpu: "10m" |
This file contains hidden or 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: extensions/v1beta1 | |
kind: Ingress | |
metadata: | |
name: example | |
annotations: | |
kubernetes.io/ingress.class: "nginx" | |
kubernetes.io/tls-acme: "true" | |
staticIPNameKey: "kubernetes-lb" | |
kubernetes.io/ingress.allow-http: "true" | |
spec: | |
tls: | |
- hosts: | |
- www.example.pl | |
- example.pl | |
secretName: example-ssl | |
rules: | |
- host: www.example.pl | |
http: &example | |
paths: | |
- backend: | |
serviceName: example | |
servicePort: 80 | |
path: / | |
- backend: | |
serviceName: example-pro | |
servicePort: 80 | |
path: /pro/ | |
- path: /healthz | |
backend: | |
serviceName: example-pro | |
servicePort: 8080 | |
- host: example.pl | |
http: *example |
This file contains hidden or 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: v1 | |
kind: Service | |
metadata: | |
name: example | |
labels: | |
app: example | |
spec: | |
ports: | |
- port: 80 | |
targetPort: 80 | |
name: http | |
protocol: TCP | |
- port: 81 | |
targetPort: 81 | |
name: redirector | |
protocol: TCP | |
selector: | |
app: example | |
type: NodePort |
This file contains hidden or 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: v1 | |
kind: Service | |
metadata: | |
name: example-pro | |
labels: | |
app: example-pro | |
usp-subsite: pro | |
spec: | |
ports: | |
- port: 80 | |
targetPort: 80 | |
name: pro | |
protocol: TCP | |
- port: 8080 | |
targetPort: 8080 | |
name: echoserver | |
protocol: TCP | |
selector: | |
app: example-pro |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment