Skip to content

Commit dd3a03c

Browse files
committed
updated for K8S 1.4. tested with minikube.
1 parent aac54fd commit dd3a03c

12 files changed

+137
-113
lines changed

infra_support/kubernetes/authsvr.yml

+6-14
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,22 @@ spec:
1010
- port: 19999
1111
targetPort: 19999
1212
selector:
13-
name: authsvr
13+
app: authsvr
1414

1515
---
16-
apiVersion: v1
17-
kind: ReplicationController
16+
apiVersion: extensions/v1beta1
17+
kind: Deployment
1818
metadata:
1919
name: authsvr
20-
labels:
21-
name: authsvr
2220
spec:
2321
replicas: 1
24-
selector:
25-
name: authsvr
2622
template:
2723
metadata:
2824
labels:
29-
name: authsvr
25+
app: authsvr
3026
spec:
3127
containers:
32-
- name: authsvr
33-
image: gcr.io/guru-gce-app1/infra-auth-server
34-
env:
35-
- name: GET_HOSTS_FROM
36-
value: dns
28+
- name: cloudsvr
29+
image: sloppycoder/infra-auth-server
3730
ports:
3831
- containerPort: 19999
39-

infra_support/kubernetes/cardsvc.yml

+9-14
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,33 @@ spec:
1010
- port: 8110
1111
targetPort: 8110
1212
selector:
13-
name: cardsvc
13+
app: cardsvc
1414

1515
---
16-
apiVersion: v1
17-
kind: ReplicationController
16+
apiVersion: extensions/v1beta1
17+
kind: Deployment
1818
metadata:
1919
name: cardsvc
20-
labels:
21-
name: cardsvc
2220
spec:
2321
replicas: 1
24-
selector:
25-
name: cardsvc
2622
template:
2723
metadata:
2824
labels:
29-
name: cardsvc
25+
app: cardsvc
3026
spec:
3127
containers:
3228
- name: cardsvc
33-
image: gcr.io/guru-gce-app1/ibank-card-service
29+
image: sloppycoder/ibank-card-service
30+
ports:
31+
- containerPort: 8110
3432
env:
3533
- name: GET_HOSTS_FROM
3634
value: dns
3735
- name: SPRING_PROFILES_ACTIVE
38-
value: "h2"
36+
value: "mysql"
3937
- name: CONFIG_SERVER_URL
4038
value: "http://cloudsvr:8761"
4139
- name: EUREKA_HOST
4240
value: "cloudsvr"
4341
- name: JDBC_URL
44-
value: "jdbc:mysql://dbhost/profdb"
45-
ports:
46-
- containerPort: 8110
47-
42+
value: "jdbc:mysql://mysql/carddb"

infra_support/kubernetes/cloudsvr.yml

+5-13
Original file line numberDiff line numberDiff line change
@@ -10,31 +10,23 @@ spec:
1010
- port: 8761
1111
targetPort: 8761
1212
selector:
13-
name: cloudsvr
13+
app: cloudsvr
1414

1515
---
16-
17-
apiVersion: v1
18-
kind: ReplicationController
16+
apiVersion: extensions/v1beta1
17+
kind: Deployment
1918
metadata:
2019
name: cloudsvr
21-
labels:
22-
name: cloudsvr
2320
spec:
2421
replicas: 1
25-
selector:
26-
name: cloudsvr
2722
template:
2823
metadata:
2924
labels:
30-
name: cloudsvr
25+
app: cloudsvr
3126
spec:
3227
containers:
3328
- name: cloudsvr
34-
image: gcr.io/guru-gce-app1/infra-cloud-server
35-
env:
36-
- name: GET_HOSTS_FROM
37-
value: dns
29+
image: sloppycoder/infra-cloud-server
3830
ports:
3931
- containerPort: 8761
4032

infra_support/kubernetes/custom.sh

-4
This file was deleted.

infra_support/kubernetes/httpd.yml.template

+5-13
Original file line numberDiff line numberDiff line change
@@ -15,30 +15,22 @@ spec:
1515
externalIPs:
1616
- NODE_EXTERNAL_IP
1717
selector:
18-
name: httpd
18+
app: httpd
1919

2020
---
21-
apiVersion: v1
22-
kind: ReplicationController
21+
apiVersion: extensions/v1beta1
22+
kind: Deployment
2323
metadata:
2424
name: httpd
25-
labels:
26-
name: httpd
2725
spec:
2826
replicas: 1
29-
selector:
30-
name: httpd
3127
template:
3228
metadata:
3329
labels:
34-
name: httpd
30+
app: httpd
3531
spec:
3632
containers:
3733
- name: httpd
38-
image: gcr.io/guru-gce-app1/ibank-web
39-
env:
40-
- name: GET_HOSTS_FROM
41-
value: dns
34+
image: sloppycoder/ibank-web
4235
ports:
4336
- containerPort: 8080
44-

infra_support/kubernetes/mysql.yml

+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
---
2+
apiVersion: v1
3+
kind: Service
4+
metadata:
5+
name: mysql
6+
labels:
7+
name: mysql
8+
spec:
9+
ports:
10+
- port: 3306
11+
targetPort: 3306
12+
selector:
13+
app: mysql
14+
15+
---
16+
apiVersion: extensions/v1beta1
17+
kind: Deployment
18+
metadata:
19+
name: mysql
20+
spec:
21+
replicas: 1
22+
template:
23+
metadata:
24+
labels:
25+
app: mysql
26+
spec:
27+
containers:
28+
- name: mysql
29+
image: "mysql:5.5"
30+
ports:
31+
- containerPort: 3306
32+
env:
33+
- name: MYSQL_ROOT_PASSWORD
34+
value: "password"
35+
36+
37+
#
38+
# to create databases for the applicaiton
39+
#
40+
#
41+
# 1. start database instance
42+
# kubectl create -f mysql.yml
43+
#
44+
# 2. get dokcer instance id using
45+
# kubectl get pods
46+
#
47+
# 3. get into the docker instance
48+
# docker exec -it <instance_id> /bin/bash
49+
#
50+
# 4. create database using the. enter 'password' when prompted
51+
# mysql -p mysql
52+
#
53+
# 5. enter following SQL statements
54+
#
55+
# CREATE DATABASE carddb CHARACTER SET utf8 COLLATE utf8_general_ci;
56+
# CREATE USER 'cardsvc'@'localhost' IDENTIFIED BY 'password';
57+
# CREATE USER 'cardsvc'@'%' IDENTIFIED BY 'password';
58+
# GRANT ALL PRIVILEGES ON carddb.* TO 'cardsvc'@'localhost';
59+
# GRANT ALL PRIVILEGES ON carddb.* TO 'cardsvc'@'%';
60+
61+
# CREATE DATABASE `profdb` CHARACTER SET utf8 COLLATE utf8_general_ci;
62+
# CREATE USER 'profsvc'@'localhost' IDENTIFIED BY 'password';
63+
# CREATE USER 'profsvc'@'%' IDENTIFIED BY 'password';
64+
# GRANT ALL PRIVILEGES ON profdb.* TO 'profsvc'@'localhost';
65+
# GRANT ALL PRIVILEGES ON profdb.* TO 'profsvc'@'%';
66+
67+

infra_support/kubernetes/profilesvc.yml

+9-14
Original file line numberDiff line numberDiff line change
@@ -10,38 +10,33 @@ spec:
1010
- port: 8110
1111
targetPort: 8110
1212
selector:
13-
name: profilesvc
13+
app: profilesvc
1414

1515
---
16-
apiVersion: v1
17-
kind: ReplicationController
16+
apiVersion: extensions/v1beta1
17+
kind: Deployment
1818
metadata:
1919
name: profilesvc
20-
labels:
21-
name: profilesvc
2220
spec:
2321
replicas: 1
24-
selector:
25-
name: profilesvc
2622
template:
2723
metadata:
2824
labels:
29-
name: profilesvc
25+
app: profilesvc
3026
spec:
3127
containers:
3228
- name: profilesvc
33-
image: gcr.io/guru-gce-app1/ibank-profile-service
29+
image: sloppycoder/ibank-profile-service
30+
ports:
31+
- containerPort: 8110
3432
env:
3533
- name: GET_HOSTS_FROM
3634
value: dns
3735
- name: SPRING_PROFILES_ACTIVE
38-
value: "h2"
36+
value: "mysql"
3937
- name: CONFIG_SERVER_URL
4038
value: "http://cloudsvr:8761"
4139
- name: EUREKA_HOST
4240
value: "cloudsvr"
4341
- name: JDBC_URL
44-
value: "jdbc:mysql://dbhost/profdb"
45-
ports:
46-
- containerPort: 8110
47-
42+
value: "jdbc:mysql://mysql/profdb"

infra_support/kubernetes/redis.yml

+5-9
Original file line numberDiff line numberDiff line change
@@ -10,26 +10,22 @@ spec:
1010
- port: 6379
1111
targetPort: 6379
1212
selector:
13-
name: redis
13+
app: redis
1414

1515
---
16-
apiVersion: v1
17-
kind: ReplicationController
16+
apiVersion: extensions/v1beta1
17+
kind: Deployment
1818
metadata:
1919
name: redis
20-
labels:
21-
name: redis
2220
spec:
2321
replicas: 1
24-
selector:
25-
name: redis
2622
template:
2723
metadata:
2824
labels:
29-
name: redis
25+
app: redis
3026
spec:
3127
containers:
3228
- name: master
33-
image: redis
29+
image: "redis:3.0.5"
3430
ports:
3531
- containerPort: 6379

infra_support/kubernetes/startall_gce

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/bin/bash
22

3+
# WARNING!!
4+
#
5+
# this script has not been updated. it may not work any more.
6+
#
7+
38
grab_ingress_ip() {
49
sleep 90
510
NODE_EXTERNAL_IP=$(kubectl describe service httpd | grep "Ingress" | cut -d ":" -f 2 | xargs)

infra_support/kubernetes/startall_vagrant renamed to infra_support/kubernetes/startall_minikube

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66

77
if [ "$NODE_EXTERNAL_IP" = "" ]; then
8-
NODE_EXTERNAL_IP=$(kubectl get nodes | tail -1 | cut -d " " -f 1)
8+
NODE_EXTERNAL_IP=$(minikube ip)
99
fi
1010

1111
echo Using external IP address =$NODE_EXTERNAL_IP=

infra_support/kubernetes/stopall

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#!/bin/bash
22

3-
kubectl stop services,rc httpd webapp profilesvc cardsvc cloudsvr authsvr redis
4-
sleep 2
3+
kubectl delete services,deployment httpd webapp profilesvc cardsvc cloudsvr authsvr redis
54
kubectl get all

0 commit comments

Comments
 (0)