forked from ninech/academy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3.yaml
103 lines (79 loc) · 2.03 KB
/
3.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
apiVersion: apps/v1beta
# Use the kind Deployment
metadata:
name: db
# Label the deployment with app: words-db
spec:
template:
metadata:
# label the pods with app: words-db
spec:
containers:
# name the pods db
- name:
# use the image dockersamples/k8s-wordsmith-db
ports:
- containerPort: 5432
name: db
---
apiVersion: v1
# Use the kind service
metadata:
name: db
# Label this service words-db
spec:
ports:
- port: 5432
targetPort: 5432
name: db
# Select the pods from the deployment above. Use the app: selector for this!
# Use the type ClusterIP
---
#######################################################
# Use the right apiversion and kind for deploying the second microservice
metadata:
name: words
# Label it with "app: words-api"
spec:
# We need 5 different replicas of the container
template:
metadata:
# Label the pods with "words-api"
spec:
containers:
# name the pods "words" and use the image dockersamples/k8s-wordsmith-api
-
ports:
- containerPort: 8080
name: api
---
# Use the right apiversion and type for a service
metadata:
name: words
# Label it with "app: words-api"
spec:
ports:
- port: 8080
targetPort: 8080
name: api
# Use a the selector from the deployment above
# Use the type ClusterIP
---
#######################################################
# Write your own Deployment object with the following attributes
# name = web
# label: app = words-web
# The underlying pods should have the following attributes
# labels: app = words-web
# name = web
# image= dockersamples/k8s-wordsmith-web
# use containerPort = 80
# name port = words-web
---
# Write your own Service with the following attributes:
# name = web
# labels: app= words-web
# type: LoadBalancer
# selector: app=words-web
# ports: Container(Target) Port 80 to port 8081
# name port web