Skip to content

Instantly share code, notes, and snippets.

@jgaskins
Created October 8, 2019 21:16
Show Gist options
  • Save jgaskins/00027f9ce585754f11d749aa73f928d6 to your computer and use it in GitHub Desktop.
Save jgaskins/00027f9ce585754f11d749aa73f928d6 to your computer and use it in GitHub Desktop.
---
kind: Service
apiVersion: v1
metadata:
name: main-app
annotations:
service.beta.kubernetes.io/do-loadbalancer-protocol: "http"
service.beta.kubernetes.io/do-loadbalancer-algorithm: "least_connections"
service.beta.kubernetes.io/do-loadbalancer-tls-ports: "443"
service.beta.kubernetes.io/do-loadbalancer-certificate-id: "YOUR_CERT_ID_GOES_HERE"
service.beta.kubernetes.io/do-loadbalancer-redirect-http-to-https: "true"
service.beta.kubernetes.io/do-loadbalancer-healthcheck-path: "/health"
spec:
type: LoadBalancer
selector:
app: main-app-web
ports:
- name: http
protocol: TCP
port: 80
targetPort: 3000
- name: https
protocol: TCP
port: 443
targetPort: 3000
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: main-app-web
spec:
replicas: 3
selector:
matchLabels:
app: main-app-web
template:
metadata:
labels:
app: main-app-web
spec:
containers:
- name: web
image: jgaskins/k8s_rails_example:latest
imagePullPolicy: Always
ports:
- containerPort: 3000
env:
- name: DATABASE_URL
value: "YOUR_DB_URL_GOES_HERE"
- name: REDIS_URL
value: "YOUR_REDIS_URL_GOES_HERE"
- name: RAILS_ENV
value: "production"
- name: RAILS_MASTER_KEY
value: "b279996cad93b536f884f57fdbec413b"
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: main-app-sidekiq
spec:
replicas: 1
selector:
matchLabels:
app: main-app-sidekiq
template:
metadata:
labels:
app: main-app-sidekiq
spec:
containers:
- name: sidekiq
image: jgaskins/k8s_rails_example:latest
imagePullPolicy: Always
command: ["bundle", "exec", "sidekiq"]
env:
- name: DATABASE_URL
value: "YOUR_DB_URL_GOES_HERE"
- name: REDIS_URL
value: "YOUR_REDIS_URL_GOES_HERE"
- name: RAILS_ENV
value: "production"
- name: RAILS_MASTER_KEY
value: "b279996cad93b536f884f57fdbec413b"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment