Skip to content

Instantly share code, notes, and snippets.

@jkinkead
Created September 7, 2017 21:06
Show Gist options
  • Save jkinkead/924dba5fc1ee4706f984fbb349a17c7a to your computer and use it in GitHub Desktop.
Save jkinkead/924dba5fc1ee4706f984fbb349a17c7a to your computer and use it in GitHub Desktop.
Complete HTTP/HTTPS Deployment & Service
kind: Deployment
metadata:
name: echo-service
labels:
application: echo-service
spec:
replicas: 1
template:
metadata:
labels:
application: echo-service
spec:
containers:
- name: echo-service
image: brndnmtthws/nginx-echo-headers:latest
ports:
- containerPort: 8080
# This name will be used in the Service.
name: backend-http
---
# Service definition for a http/https service.
apiVersion: v1
kind: Service
metadata:
name: echo-service
annotations:
# Note that the backend talks over HTTP.
service.beta.kubernetes.io/aws-load-balancer-backend-protocol: http
# TODO: Fill in with the ARN of your certificate.
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:{region}:{user id}:certificate/{id}
# Only run SSL on the port named "https" below.
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "https"
spec:
type: LoadBalancer
loadBalancerIP:
ports:
- port: 80
name: http
# Use named container port.
targetPort: backend-http
- port: 443
name: https
# Use named container port.
targetPort: backend-http
selector:
application: echo-service
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment