Merging Everything into the Same YAML Definition
In this lesson, we will merge all the definitions explored until now into a single YAML file and then create objects using that file.
Looking into the Merged File
Consider this lesson a short intermezzo. We’ll merge the definitions we used in this chapter into a single YAML file.
You already had a similar example before, so there’s no need for lengthy explanations.
Press + to interact
cat deploy/go-demo-2.yml
The output is as follows.
Press + to interact
apiVersion: apps/v1beta2kind: Deploymentmetadata:name: go-demo-2-dblabels:type: dbservice: go-demo-2vendor: MongoLabsspec:selector:matchLabels:type: dbservice: go-demo-2strategy:type: Recreatetemplate:metadata:labels:type: dbservice: go-demo-2vendor: MongoLabsspec:containers:- name: dbimage: mongo:3.3---apiVersion: v1kind: Servicemetadata:name: go-demo-2-dbspec:ports:- port: 27017selector:type: dbservice: go-demo-2---apiVersion: apps/v1beta2kind: Deploymentmetadata:name: go-demo-2-apilabels:type: apiservice: go-demo-2language: gospec:replicas: 3selector:matchLabels:type: apiservice: go-demo-2template:metadata:labels:type: apiservice: go-demo-2language: gospec:containers:- name: apiimage: vfarcic/go-demo-2env:- name: DBvalue: go-demo-2-dbreadinessProbe:httpGet:path: /demo/helloport: 8080periodSeconds: 1livenessProbe:httpGet:path: /demo/helloport: 8080---apiVersion: v1kind: Servicemetadata:name: go-demo-2-apispec:type: NodePortports:- port: 8080selector:type: apiservice: go-demo-2
The Differences
If you start ...
Access this course and 1400+ top-rated courses and projects.