-
Notifications
You must be signed in to change notification settings - Fork 53
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 #50
base: main
Are you sure you want to change the base?
Solution #50
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
|
||
*/*/__pycache__/* | ||
*/*/*/__pycache__/* | ||
.idea | ||
DS_Store |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: busybox | ||
namespace: todoapp | ||
spec: | ||
containers: | ||
- name: busybox | ||
image: ikulyk404/busyboxplus:curl | ||
imagePullPolicy: IfNotPresent | ||
args: | ||
- sleep | ||
- "1000" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
apiVersion: v1 | ||
kind: Namespace | ||
metadata: | ||
name: todoapp |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
apiVersion: v1 | ||
kind: Pod | ||
metadata: | ||
name: todoapp | ||
labels: | ||
role: todoapp | ||
spec: | ||
containers: | ||
- name: todoapp | ||
image: vpcomtek/todoapp:3.0.0 | ||
imagePullPolicy: IfNotPresent | ||
ports: | ||
- name: todoapp | ||
containerPort: 8080 | ||
protocol: TCP | ||
livenessProbe: | ||
httpGet: | ||
path: api/liveness | ||
port: 8080 | ||
initialDelaySeconds: 60 | ||
periodSeconds: 5 | ||
readinessProbe: | ||
httpGet: | ||
path: api/readiness | ||
port: 8080 | ||
initialDelaySeconds: 5 | ||
periodSeconds: 5 | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
FROM python:3.8 | ||
|
||
WORKDIR /app | ||
|
||
COPY ./src /app | ||
|
||
RUN pip install --upgrade pip && \ | ||
pip install -r requirements.txt | ||
|
||
EXPOSE 8080 | ||
|
||
ENTRYPOINT ["sh", "-c", "python manage.py migrate && python manage.py runserver 0.0.0.0:8080"] |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
# Instruction | ||
### How to Apply All Manifests | ||
``` | ||
kubectl apply -f .infrastructure/namespace.yml | ||
kubectl apply -f .infrastructure/busybox.yml | ||
kubectl apply -f .infrastructure/todoapp-pod.yml | ||
``` | ||
### Testing ToDo Application Using port-forward | ||
``` | ||
kubectl port-forward pod/todoapp -n todoapp 8000:8000 | ||
``` | ||
- Visit http://localhost:8000 to access the application. | ||
### Testing Application Using busyboxplus:curl | ||
``` | ||
kubectl exec -it busybox -n todoapp -- curl http://todoapp:8000 | ||
kubectl exec -it busybox -n todoapp -- curl http://todoapp:8000/readiness | ||
kubectl exec -it busybox -n todoapp -- curl http://todoapp:8000/liveness | ||
``` | ||
or | ||
|
||
1. Retrieve the IP address of the TodoApp pod: | ||
``` | ||
kubectl get pods -n todoapp -o wide | ||
``` | ||
2. Access the BusyBox shell: | ||
``` | ||
kubectl -n todoapp exec -it busybox -- sh | ||
``` | ||
3. Send a curl request to the TodoApp: | ||
``` | ||
curl <TodoApp_IP_address>:8080 | ||
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ensure that the
todoapp
namespace exists in your Kubernetes cluster. If it doesn't, you need to create it or change this to a namespace that does exist.