Skip to content

Instantly share code, notes, and snippets.

@zaneclaes
Last active July 17, 2019 03:52
Show Gist options
  • Save zaneclaes/4901f9a30baa119953c1f8074390cff9 to your computer and use it in GitHub Desktop.
Save zaneclaes/4901f9a30baa119953c1f8074390cff9 to your computer and use it in GitHub Desktop.
A simple version of a Switchboard deployment via k8s
apiVersion: apps/v1
kind: Deployment
metadata:
name: switchboard
labels:
app: switchboard
spec:
replicas: 2
minReadySeconds: 5
selector:
matchLabels:
app: switchboard
template:
metadata:
labels:
app: switchboard
annotations:
iam.amazonaws.com/role: arn:aws:iam::xxxxxxx:role/k8s-switchboard
spec:
initContainers:
# Wait for permissions (kube2iam may take a moment)
- name: startup
image: mesosphere/aws-cli:latest
command: ['sh', '-c', 'until aws s3 ls s3://my-secure-bucket; do echo waiting for s3 permissions; sleep 10; done;']
containers:
# BALANCER TLS termination & routing via envoy
- name: switchboard
image: inzania/switchboard:latest
imagePullPolicy: Always
readinessProbe:
httpGet:
path: /
port: 5000
initialDelaySeconds: 30
timeoutSeconds: 20
periodSeconds: 60
livenessProbe:
httpGet:
path: /
port: 5000
initialDelaySeconds: 180
timeoutSeconds: 20
periodSeconds: 60
env:
- name: AWS_DEFAULT_REGION
value: us-east-2
- name: S3_BUCKET
value: my-secure-bucket
- name: EMAIL
value: "zane@claes.biz"
- name: INGRESS
value: >
https!://api:experium.online:experium
https!://api:datasculpt.io/experium-online!:experium
https!://api:datasculpt.io/card-grid!:cardgrid
https!://blog:experium.online:multipress
https!://www?:skillcookbook.com:multipress
https!://:technicallywizardry.com:www.technicallywizardry.com
https!://www:technicallywizardry.com:multipress
https?://www?:makerbuildlog.com:www.technicallywizardry.com
https?://www?:examinedself.com:www.technicallywizardry.com
- name: EGRESS
value: >
experium:http://localhost:5200
experium:grpc://localhost:5201
cardgrid:http://localhost:5202
cardgrid:grpc://localhost:5203
multipress:http://localhost:8888
- name: DEFAULT_ROUTE
value: multipress
- name: LOG_FORMAT_SWITCHBOARD
value: '{"@timestamp": "%(asctime)s", "level": "%(levelname)s", "name": "%(name)s", "message": "%(message)s"}'
- name: LOG_FORMAT_ENVOY
value: '{\"@timestamp\": \"%Y-%m-%d %T.%F\", \"level\": \"%l\", \"thread_id\": \"%t\", \"name\": \"%n\", \"message\": \"%v\"}'
- name: LOG_FORMAT_ACCESS_JSON
value: >
{
"@timestamp": "%START_TIME%",
"processor": "net",
"router": "%ROUTER%",
"duration": "%DURATION%",
"http.method": "%REQ(:METHOD)%",
"http.url": "%REQ(X-FORWARDED-PROTO)%://%REQ(:AUTHORITY)%%REQ(X-ENVOY-ORIGINAL-PATH?:PATH)%",
"http.protocol": "%PROTOCOL%",
"http.status_code": "%RESPONSE_CODE%",
"http.useragent": "%REQ(USER-AGENT)%",
"http.request_id": "%REQ(X-REQUEST-ID)%",
"http.response_flags": "%RESPONSE_FLAGS%",
"http.referer": "%REQ(REFERER)%",
"network.destination.ip": "%UPSTREAM_HOST%",
"network.destination.cluster": "%UPSTREAM_CLUSTER%",
"network.destination.duration": "%RESP(X-ENVOY-UPSTREAM-SERVICE-TIME)%",
"network.client.ip": "%REQ(X-FORWARDED-FOR)%",
"network.bytes_read": "%BYTES_RECEIVED%",
"network.bytes_written": "%BYTES_SENT%",
"grpc_status": "%RESP(GRPC-STATUS)%"
}
ports:
- containerPort: 8080
- containerPort: 8443
- containerPort: 5000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment