Skip to content

Commit ac5c783

Browse files
committed
yaml files
1 parent 48050dd commit ac5c783

10 files changed

+615
-20
lines changed

.gitignore

+4-1
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,7 @@ target/
1313
# Eclipse
1414
**/*.project
1515
**/*.classpath
16-
**/*.settings
16+
**/*.settings
17+
18+
# K8S generated files
19+
kubernetes/deploy/

.scripts/e2e-using-aks.sh

+65-19
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,69 @@ docker run -p 127.0.0.1:8888:8888 ${CONTAINER_REGISTRY}.azurecr.io/config
5555
# install kubectl
5656
# https://kubernetes.io/docs/tasks/tools/install-kubectl/
5757

58+
cd kubernetes
59+
60+
# deploy secrets
61+
envsubst < 0-secrets.yaml > deploy/0-secrets.yaml
62+
kubectl apply -f deploy/0-secrets.yaml
63+
64+
# deploy config
65+
envsubst < 1-config.yaml > deploy/1-config.yaml
66+
kubectl apply -f deploy/1-config.yaml
67+
68+
# deploy registry
69+
envsubst < 2-registry.yaml > deploy/2-registry.yaml
70+
kubectl apply -f deploy/2-registry.yaml
71+
72+
# deploy gateway
73+
envsubst < 3-gateway.yaml > deploy/3-gateway.yaml
74+
kubectl apply -f deploy/3-gateway.yaml
75+
76+
# deploy auth-service
77+
envsubst < 4-auth-service.yaml > deploy/4-auth-service.yaml
78+
kubectl apply -f deploy/4-auth-service.yaml
79+
80+
# deploy account-service
81+
envsubst < 5-account-service.yaml > deploy.5-account-service.yaml
82+
kubectl apply -f deploy/5-account-service.yaml
83+
84+
# deploy statistics-service
85+
envsubst < 6-statistics-service.yaml > deploy/6-statistics-service.yaml
86+
kubeclt apply -f deploy/6-statistics-service.yaml
87+
88+
# deploy notification-service
89+
envsubst < 7-notification-service.yaml > deploy/7-notification-service.yaml
90+
kubectl apply -f deploy/7-notification-service.yaml
91+
92+
# look up
93+
bash-3.2$ kubectl get services
94+
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
95+
account-service ClusterIP 10.0.114.121 <none> 6000/TCP 7m18s
96+
auth-service ClusterIP 10.0.85.141 <none> 5000/TCP 9m12s
97+
config LoadBalancer 10.0.205.56 52.143.85.191 8888:31213/TCP 4h23m
98+
gateway LoadBalancer 10.0.189.35 51.143.122.223 80:32508/TCP 12m
99+
kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 49d
100+
notification-service ClusterIP 10.0.195.170 <none> 8000/TCP 3m58s
101+
registry LoadBalancer 10.0.218.238 52.137.101.136 8761:30758/TCP 4h16m
102+
statistics-service ClusterIP 10.0.179.87 <none> 7000/TCP 5m4s
103+
104+
105+
# few additional commands
106+
107+
kubectl get pods
108+
kubectl get services
109+
kubectl get svc gateway
110+
kubectl delete pod [pod-name]
111+
kubectl delete deployment [deployment-name]
112+
kubectl delete service [service-name]
113+
kubectl get secret piggymetrics -o yaml
114+
115+
http://.../actuator
116+
117+
# https://codefresh.io/kubernetes-tutorial/kubernetes-cheat-sheet/
118+
119+
# ========= old stuff =================
120+
58121
# install kompose
59122
# https://kubernetes.io/docs/tasks/configure-pod-container/translate-compose-kubernetes/
60123

@@ -75,28 +138,10 @@ kubectl apply -f statistics-service-service.yaml
75138
kubectl apply -f notification-service-deployment.yaml
76139
kubectl apply -f notification-service-service.yaml
77140

78-
bash-3.2$ kubectl get services
79-
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
80-
account-service ClusterIP 10.0.195.104 <none> 6000/TCP 4m13s
81-
auth-service ClusterIP 10.0.131.170 <none> 5000/TCP 3m35s
82-
config LoadBalancer 10.0.49.222 51.143.107.33 8888:31212/TCP 6m28s
83-
gateway LoadBalancer 10.0.208.189 40.91.122.33 80:32131/TCP 5m
84-
kubernetes ClusterIP 10.0.0.1 <none> 443/TCP 48d
85-
notification-service ClusterIP 10.0.60.69 <none> 8000/TCP 3m2s
86-
registry LoadBalancer 10.0.122.108 52.143.74.122 8761:32475/TCP 5m31s
87-
statistics-service ClusterIP 10.0.232.183 <none> 7000/TCP 3m17s
88141

89142

90-
# few additional commands
91143

92-
kubectl get pods
93-
kubectl get services
94-
kubectl get svc gateway
95-
kubectl delete pod [pod-name]
96144

97-
http://.../actuator
98-
99-
# https://codefresh.io/kubernetes-tutorial/kubernetes-cheat-sheet/
100145

101146

102147
# Azure Monitor - Kusto Query
@@ -147,4 +192,5 @@ LAST DEPLOYED: Mon Dec 2 08:46:25 2019
147192
NAMESPACE: default
148193
STATUS: deployed
149194
REVISION: 1
150-
TEST SUITE: None
195+
TEST SUITE: None
196+

kubernetes/0-secrets.yaml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: piggymetrics
5+
type: Opaque
6+
stringData:
7+
config_service_password: $CONFIG_SERVICE_PASSWORD
8+
account_service_password: $ACCOUNT_SERVICE_PASSWORD
9+
statistics_service_password: $STATISTICS_SERVICE_PASSWORD
10+
notification_service_password: $NOTIFICATION_SERVICE_PASSWORD
11+
mongodb_database: $MONGODB_DATABASE
12+
mongodb_uri: $MONGODB_URI
13+
rabbitmq_host: $RABBITMQ_HOST
14+
rabbitmq_port: "$RABBITMQ_PORT"
15+
rabbitmq_username: $RABBITMQ_USERNAME
16+
rabbitmq_password: $RABBITMQ_PASSWORD
17+
notification_email_host: $SMTP_HOST
18+
notification_email_port: "$SMTP_PORT"
19+
notification_email_user: $SMTP_USER
20+
notification_email_pass: $SMTP_PASSWORD

kubernetes/1-config.yaml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
labels:
6+
project: piggymetrics
7+
tier: middleware
8+
app: config
9+
name: config
10+
spec:
11+
type: LoadBalancer
12+
ports:
13+
- name: http
14+
port: 8888
15+
targetPort: 8888
16+
selector:
17+
project: piggymetrics
18+
tier: middleware
19+
app: config
20+
status:
21+
loadBalancer: {}
22+
---
23+
apiVersion: extensions/v1beta1
24+
kind: Deployment
25+
metadata:
26+
labels:
27+
project: piggymetrics
28+
tier: middleware
29+
app: config
30+
name: config
31+
spec:
32+
replicas: 1
33+
strategy:
34+
type: RollingUpdate
35+
template:
36+
metadata:
37+
labels:
38+
project: piggymetrics
39+
tier: middleware
40+
app: config
41+
spec:
42+
containers:
43+
- env:
44+
- name: CONFIG_SERVICE_PASSWORD
45+
valueFrom:
46+
secretKeyRef:
47+
name: piggymetrics
48+
key: config_service_password
49+
image: ${CONTAINER_REGISTRY}.azurecr.io/piggymetrics-config
50+
name: config
51+
ports:
52+
- containerPort: 8888
53+
resources: {}
54+
restartPolicy: Always
55+
status: {}

kubernetes/2-registry.yaml

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
labels:
6+
project: piggymetrics
7+
tier: middleware
8+
app: registry
9+
name: registry
10+
spec:
11+
type: LoadBalancer
12+
ports:
13+
- name: http
14+
port: 8761
15+
targetPort: 8761
16+
selector:
17+
project: piggymetrics
18+
tier: middleware
19+
app: registry
20+
status:
21+
loadBalancer: {}
22+
---
23+
apiVersion: extensions/v1beta1
24+
kind: Deployment
25+
metadata:
26+
labels:
27+
project: piggymetrics
28+
tier: middleware
29+
app: registry
30+
name: registry
31+
spec:
32+
replicas: 1
33+
strategy:
34+
type: RollingUpdate
35+
template:
36+
metadata:
37+
labels:
38+
project: piggymetrics
39+
tier: middleware
40+
app: registry
41+
spec:
42+
containers:
43+
- env:
44+
- name: CONFIG_SERVICE_PASSWORD
45+
valueFrom:
46+
secretKeyRef:
47+
name: piggymetrics
48+
key: config_service_password
49+
image: ${CONTAINER_REGISTRY}.azurecr.io/piggymetrics-registry
50+
name: registry
51+
ports:
52+
- containerPort: 8761
53+
resources: {}
54+
restartPolicy: Always
55+
status: {}

kubernetes/3-gateway.yaml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
labels:
6+
project: piggymetrics
7+
tier: frontend
8+
app: gateway
9+
name: gateway
10+
spec:
11+
type: LoadBalancer
12+
ports:
13+
- name: http
14+
port: 80
15+
targetPort: 4000
16+
selector:
17+
project: piggymetrics
18+
tier: frontend
19+
app: gateway
20+
---
21+
apiVersion: extensions/v1beta1
22+
kind: Deployment
23+
metadata:
24+
name: gateway
25+
labels:
26+
project: piggymetrics
27+
tier: frontend
28+
app: gateway
29+
spec:
30+
replicas: 1
31+
strategy:
32+
type: RollingUpdate
33+
template:
34+
metadata:
35+
creationTimestamp: null
36+
labels:
37+
project: piggymetrics
38+
tier: frontend
39+
app: gateway
40+
spec:
41+
containers:
42+
- name: gateway
43+
env:
44+
- name: CONFIG_SERVICE_PASSWORD
45+
valueFrom:
46+
secretKeyRef:
47+
name: piggymetrics
48+
key: config_service_password
49+
image: ${CONTAINER_REGISTRY}.azurecr.io/piggymetrics-gateway
50+
ports:
51+
- containerPort: 4000
52+
restartPolicy: Always

kubernetes/4-auth-service.yaml

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
---
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
labels:
6+
project: piggymetrics
7+
tier: backend
8+
app: auth-service
9+
name: auth-service
10+
spec:
11+
ports:
12+
- name: http
13+
port: 5000
14+
targetPort: 5000
15+
selector:
16+
project: piggymetrics
17+
tier: infrastructure
18+
app: auth-service
19+
status:
20+
loadBalancer: {}
21+
---
22+
apiVersion: extensions/v1beta1
23+
kind: Deployment
24+
metadata:
25+
labels:
26+
project: piggymetrics
27+
tier: backend
28+
app: auth-service
29+
name: auth-service
30+
spec:
31+
replicas: 1
32+
strategy:
33+
type: RollingUpdate
34+
template:
35+
metadata:
36+
labels:
37+
project: piggymetrics
38+
tier: infrastructure
39+
app: auth-service
40+
spec:
41+
containers:
42+
- env:
43+
- name: CONFIG_SERVICE_PASSWORD
44+
valueFrom:
45+
secretKeyRef:
46+
name: piggymetrics
47+
key: config_service_password
48+
- name: ACCOUNT_SERVICE_PASSWORD
49+
valueFrom:
50+
secretKeyRef:
51+
name: piggymetrics
52+
key: account_service_password
53+
- name: STATISTICS_SERVICE_PASSWORD
54+
valueFrom:
55+
secretKeyRef:
56+
name: piggymetrics
57+
key: statistics_service_password
58+
- name: NOTIFICATION_SERVICE_PASSWORD
59+
valueFrom:
60+
secretKeyRef:
61+
name: piggymetrics
62+
key: notification_service_password
63+
- name: MONGODB_DATABASE
64+
valueFrom:
65+
secretKeyRef:
66+
name: piggymetrics
67+
key: mongodb_database
68+
- name: MONGODB_URI
69+
valueFrom:
70+
secretKeyRef:
71+
name: piggymetrics
72+
key: mongodb_uri
73+
image: ${CONTAINER_REGISTRY}.azurecr.io/piggymetrics-auth-service
74+
name: auth-service
75+
ports:
76+
- containerPort: 5000
77+
resources: {}
78+
restartPolicy: Always
79+
status: {}

0 commit comments

Comments
 (0)