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 #21

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
10 changes: 5 additions & 5 deletions .infrastructure/busybox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ metadata:
namespace: todoapp
spec:
containers:
- name: busybox
image: radial/busyboxplus:curl
args:
- sleep
- "1000"
- name: busybox
image: radial/busyboxplus:curl
args:
- sleep
- "1000"
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: todoappclusterip
namespace: todoapp
spec:
selector:
app: todoapp
type: ClusterIP
ports:
- protocol: TCP
port: 80
targetPort: 8000
2 changes: 1 addition & 1 deletion .infrastructure/namespace.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: todoapp
name: todoapp
15 changes: 15 additions & 0 deletions .infrastructure/nodeport.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Service
metadata:
name: todoappnodeport
namespace: todoapp
spec:
type: NodePort
selector:
app: todoapp

ports:
- protocol: TCP
port: 80
targetPort: 8000
nodePort: 30004
60 changes: 44 additions & 16 deletions .infrastructure/todoapp-pod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,49 @@ kind: Pod
metadata:
name: todoapp
namespace: todoapp
labels:
app: todoapp
spec:
containers:
- name: todoapp
image: ikulyk404/todoapp:3.0.0
ports:
- containerPort: 8080
livenessProbe:
httpGet:
path: api/health
port: 8080
initialDelaySeconds: 60
periodSeconds: 5
readinessProbe:
httpGet:
path: api/ready
port: 8080
initialDelaySeconds: 5
periodSeconds: 5
- name: todoapp
image: fredfredburger/todoapp:3.0.2
ports:
- containerPort: 8000
livenessProbe:
httpGet:
path: api/health
port: 8000
initialDelaySeconds: 60
periodSeconds: 5
readinessProbe:
httpGet:
path: api/readiness
port: 8000
initialDelaySeconds: 5
periodSeconds: 5
---
apiVersion: v1
kind: Pod
metadata:
name: todoapp-1
namespace: todoapp
labels:
app: todoapp
spec:
containers:
- name: todoapp
image: fredfredburger/todoapp:3.0.2
ports:
- containerPort: 8000
livenessProbe:
httpGet:
path: api/health
port: 8000
initialDelaySeconds: 60
periodSeconds: 5
readinessProbe:
httpGet:
path: api/readiness
port: 8000
initialDelaySeconds: 5
periodSeconds: 5
23 changes: 22 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
This is a todo list web application with basic features of most web apps, i.e., accounts/login, API, and interactive UI. To do this task, you will need:

- CSS | [Skeleton](http://getskeleton.com/)
- JS | [jQuery](https://jquery.com/)
- JS | [jQuery](https://jquery.com/)

## Explore

Expand Down Expand Up @@ -41,3 +41,24 @@ 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.

create namespace `kubectl apply -f .\.infrastructure\namespace.yml`

start pods `kubectl apply -f .\.infrastructure\todoapp-pod.yml`

start busybox pod `kubectl apply -f .\.infrastructure\busybox.yml`

start cluster ip service `kubectl apply -f .\.infrastructure\clusterip.yml`

start node port service `kubectl apply -f .\.infrastructure\nodeport.yml`

enter busybox container `kubectl -n todoapp exec -it busybox -- sh`

to check connection to your cluster ip from busybox run `curl http://todoappclusterip.todoapp.svc.cluster.local`

to check connection using port forwarding run `kubectl port-forward service/todoappclusterip 8001:80 -n todoapp`

while port forwarding is running in background you can acces your webapp using the link http://localhost:8001/

to check acces from nodeport use link http://localhost:30004/
to do the cleanup run `kubectl delete namespace todoapp cleanup`