Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Solution #20

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .infrastructure/ClusterIP.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: v1
kind: Service
metadata:
name: todoapp-clusterip-service
namespace: todoapp
spec:
selector:
app: todoapp
ports:
- protocol: TCP
port: 80
targetPort: 8080
type: ClusterIP

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EOF

14 changes: 14 additions & 0 deletions .infrastructure/NodePort.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: todoapp-nodeport-service
namespace: todoapp
spec:
type: NodePort
selector:
app: todoapp
ports:
- protocol: TCP
port: 80
targetPort: 8080
nodePort: 30007

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EOF

2 changes: 1 addition & 1 deletion .infrastructure/busybox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ metadata:
spec:
containers:
- name: busybox
image: radial/busyboxplus:curl
image: busybox:stable
args:
- sleep
- "1000"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EOF

38 changes: 37 additions & 1 deletion .infrastructure/todoapp-pod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,48 @@ kind: Pod
metadata:
name: todoapp
namespace: todoapp
labels:
app: todoapp
spec:
containers:
- name: todoapp
image: ikulyk404/todoapp:3.0.0
image: XtheCutter/todoapp:3.0.0
ports:
- containerPort: 8080
env:
- name: PYTHONUNBUFFERED
value: "1"
livenessProbe:
httpGet:
path: api/health
port: 8080
initialDelaySeconds: 60
periodSeconds: 5
readinessProbe:
httpGet:
path: api/ready
port: 8080
initialDelaySeconds: 5
periodSeconds: 5

---

apiVersion: v1
kind: Pod
metadata:
name: todoapp-2
namespace: todoapp
labels:
app: todoapp
spec:
containers:
- name: todoapp
image: XtheCutter/todoapp:3.0.0
ports:
- containerPort: 8080
env:
- name: PYTHONUNBUFFERED
value: "1"
livenessProbe:
httpGet:
path: api/health
Expand Down
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,17 @@ Create a kubernetes manifest for a pod which will containa ToDo app container:
1. `README.md` file should contain instructions on how to test ToDo application using the service `port-forward` command
1. `README.md` should contain instruction on how to access an app using a NodePort Service
1. Create PR with your changes and attach it for validation on a platform.

kubectl apply -f clusterIp.yml
kubectl apply -f nodeport.yml

kubectl get services -o wide
kubectl port-forward service/todoapp-clusterip-service 8081:80 -n todoapp

Check: http://localhost:8081

Test:
kubectl -n todoapp exec -it busybox -- sh
curl http://todoapp-clusterip-service.todoapp.svc.cluster.local

http://localhost:30007