Skip to content

Commit c0c1bc6

Browse files
committed
initial add
0 parents  commit c0c1bc6

4 files changed

Lines changed: 50 additions & 0 deletions

File tree

app/Dockerfile

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
FROM python:3.7
2+
3+
RUN mkdir /app
4+
WORKDIR /app
5+
ADD . /app/
6+
RUN pip install -r requirements.txt
7+
8+
EXPOSE 5000
9+
CMD ["python", "/app/main.py"]

app/main.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
from flask import Flask
2+
app = Flask(__name__)
3+
4+
@app.route("/")
5+
def hello():
6+
return "Hello from Python!"
7+
8+
if __name__ == "__main__":
9+
app.run(host='0.0.0.0')

app/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Flask

kubernetes/deployment.yaml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
name: hello-python-service
5+
spec:
6+
selector:
7+
app: hello-python
8+
ports:
9+
- protocol: "TCP"
10+
port: 6000
11+
targetPort: 5000
12+
type: LoadBalancer
13+
14+
15+
---
16+
apiVersion: apps/v1beta1
17+
kind: Deployment
18+
metadata:
19+
name: hello-python
20+
spec:
21+
replicas: 4
22+
template:
23+
metadata:
24+
labels:
25+
app: hello-python
26+
spec:
27+
containers:
28+
- name: hello-python
29+
image: hello-python:latest
30+
ports:
31+
- containerPort: 5000

0 commit comments

Comments
 (0)