Skip to content

Instantly share code, notes, and snippets.

@Subv
Last active March 18, 2018 06:29
Show Gist options
  • Save Subv/172fa8f4f539c5dcc4c50b42edb3b43f to your computer and use it in GitHub Desktop.
Save Subv/172fa8f4f539c5dcc4c50b42edb3b43f to your computer and use it in GitHub Desktop.
Kubernetes Deployments
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: mysql-deployment
spec:
selector:
matchLabels:
app: mysql
replicas: 1
template: # create pods using pod definition in this template
metadata:
labels:
app: mysql
spec:
containers:
- name: mysql
image: mysql:5.7
ports:
- containerPort: 3306
# env sets environment variables in the container
# exactly like environment variables set from the command line
env:
- name: MYSQL_ROOT_PASSWORD
value: "12345"
- name: MYSQL_DATABASE
value: "operaciones"
apiVersion: v1
kind: Service
metadata:
name: mysql-service
labels:
app: mysql-service
spec:
ports:
- port: 3306
targetPort: 3306
protocol: TCP
selector:
app: mysql
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: php-deployment
spec:
selector:
matchLabels:
app: php
replicas: 1
template: # create pods using pod definition in this template
metadata:
labels:
app: php
spec:
containers:
- name: php
image: subv/plataformasdesarrollo:phpdemo_v3
ports:
- containerPort: 80
apiVersion: v1
kind: Service
metadata:
name: php-service
labels:
app: php-service
spec:
ports:
- port: 80
targetPort: 80
protocol: TCP
selector:
app: php
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment