Created
March 17, 2016 16:50
-
-
Save spalladino/a4e86b9f7e5856722afe to your computer and use it in GitHub Desktop.
Kubernetes sample config files for running Brium web app with a MySQL service on Google Container Engine
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: extensions/v1beta1 | |
kind: Job | |
metadata: | |
name: brium-dbsetup | |
spec: | |
selector: | |
matchLabels: | |
app: brium-dbsetup | |
template: | |
metadata: | |
name: brium-dbsetup | |
labels: | |
app: brium-dbsetup | |
spec: | |
containers: | |
- name: brium-dbsetup | |
image: us.gcr.io/brium-1253/brium:latest | |
command: ["rake", "db:setup"] | |
env: | |
- name: DATABASE_URL | |
value: "mysql2://root@mysql/brium" | |
- name: RAILS_ENV | |
value: production | |
restartPolicy: Never |
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: v1 | |
kind: Service | |
metadata: | |
labels: | |
name: brium-frontend | |
name: brium-frontend | |
spec: | |
type: LoadBalancer | |
ports: | |
# The port that this service should serve on. | |
- port: 80 | |
targetPort: 80 | |
protocol: TCP | |
# Label keys and values that must match in order to receive traffic for this service. | |
selector: | |
name: brium-web |
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: v1 | |
kind: Pod | |
metadata: | |
name: brium-web | |
labels: | |
name: brium-web | |
spec: | |
containers: | |
- image: us.gcr.io/brium-1253/brium:latest | |
name: brium-web | |
env: | |
- name: DATABASE_URL | |
value: "mysql2://root@mysql/brium" | |
- name: RAILS_ENV | |
value: production | |
ports: | |
- containerPort: 80 | |
name: brium-web |
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: v1 | |
kind: Service | |
metadata: | |
labels: | |
name: mysql | |
name: mysql | |
spec: | |
ports: | |
- port: 3306 | |
# Label keys and values that must match in order to receive traffic for this service. | |
selector: | |
name: mysql |
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: v1 | |
kind: Pod | |
metadata: | |
name: mysql | |
labels: | |
name: mysql | |
spec: | |
containers: | |
- resources: | |
limits: | |
cpu: 0.3 | |
requests: | |
cpu: 0.1 | |
image: mysql:5.6 | |
name: mysql | |
env: | |
- name: MYSQL_ALLOW_EMPTY_PASSWORD | |
value: "yes" | |
ports: | |
- containerPort: 3306 | |
name: mysql | |
volumeMounts: | |
- name: mysql-persistent-storage | |
mountPath: /var/lib/mysql | |
volumes: | |
# Create with `gcloud compute disks create --size 30GB mysql-data` | |
- name: mysql-persistent-storage | |
gcePersistentDisk: | |
pdName: mysql-data | |
fsType: ext4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment