Skip to content

Commit ffa649c

Browse files
author
Bruno Krebs
committed
running sample on Minikube;
1 parent 5f38363 commit ffa649c

File tree

5 files changed

+99
-0
lines changed

5 files changed

+99
-0
lines changed

README.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,34 @@ npm i
2626
# run the frontend app
2727
npm start
2828
```
29+
30+
### Running on Minikube
31+
32+
References:
33+
34+
- https://medium.com/@awkwardferny/getting-started-with-kubernetes-ingress-nginx-on-minikube-d75e58f52b6c
35+
- https://medium.freecodecamp.org/learn-kubernetes-in-under-3-hours-a-detailed-guide-to-orchestrating-containers-114ff420e882
36+
37+
Create all the resources (deployment, services, and ingress):
38+
39+
```bash
40+
kubectl apply -f resources-manifests/deployment.yaml
41+
kubectl apply -f resources-manifests/backend-service.yaml
42+
kubectl apply -f resources-manifests/frontend-service.yaml
43+
kubectl apply -f resources-manifests/ingress.yaml
44+
```
45+
46+
Then, find out the IP address of the Minikube cluster:
47+
48+
```bash
49+
minikube ip
50+
```
51+
52+
Finally, head to a web browser and hit the IP address returned by the command above. Also, if needed you can use the following commands to shutdown everything:
53+
54+
```bash
55+
kubectl delete -f resources-manifests/deployment.yaml
56+
kubectl delete -f resources-manifests/backend-service.yaml
57+
kubectl delete -f resources-manifests/frontend-service.yaml
58+
kubectl delete -f resources-manifests/ingress.yaml
59+
```
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: react-tutorial-backend-service
5+
spec:
6+
type: NodePort
7+
ports:
8+
- port: 8081
9+
targetPort: 8081
10+
protocol: TCP
11+
name: frontend-port
12+
selector:
13+
app: react-tutorial
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
apiVersion: extensions/v1beta1
2+
kind: Deployment
3+
metadata:
4+
name: react-tutorial
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: react-tutorial
10+
template:
11+
metadata:
12+
labels:
13+
app: react-tutorial
14+
spec:
15+
containers:
16+
- name: react-tutorial-frontend
17+
image: brunokrebs/react-tutorial
18+
ports:
19+
- containerPort: 3000
20+
- name: react-tutorial-backend
21+
image: brunokrebs/react-tutorial-backend
22+
ports:
23+
- containerPort: 8081
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: react-tutorial-frontend-service
5+
spec:
6+
type: NodePort
7+
ports:
8+
- port: 3000
9+
targetPort: 80
10+
protocol: TCP
11+
name: frontend-port
12+
selector:
13+
app: react-tutorial

resources-manifests/ingress.yaml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
apiVersion: extensions/v1beta1
2+
kind: Ingress
3+
metadata:
4+
name: react-tutorial-ingress
5+
annotations:
6+
nginx.ingress.kubernetes.io/rewrite-target: /
7+
nginx.ingress.kubernetes.io/ssl-redirect: "false"
8+
spec:
9+
rules:
10+
- http:
11+
paths:
12+
- path: /backend
13+
backend:
14+
serviceName: react-tutorial-backend-service
15+
servicePort: 8081
16+
- path: /
17+
backend:
18+
serviceName: react-tutorial-frontend-service
19+
servicePort: 3000

0 commit comments

Comments
 (0)