This commit is contained in:
Sharad Ahlawat
2021-04-20 12:34:43 -07:00
parent 2e8bdabea2
commit 10b9cbeead
22 changed files with 483 additions and 4 deletions

View File

@ -0,0 +1,9 @@
FROM python:3.8-slim-buster
WORKDIR /usr/src/app
COPY requirements.txt ./
RUN pip install --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
ENTRYPOINT ["python"]
EXPOSE 8080
CMD ["app.py"]

14
k8s/apps/pyserver/app.py Normal file
View File

@ -0,0 +1,14 @@
from flask import Flask
import os
app = Flask(__name__)
@app.route('/')
def hello_world(count=0):
count += 1
return "Hello World! #" + str(count) + "\nfrom: " + os.getenv('HOSTNAME', "unknown") + "\n"
if __name__ == '__main__':
app.run(host='0.0.0.0', port='8080')

View File

@ -0,0 +1,3 @@
flask
flask_cors
dapr

View File

@ -0,0 +1,35 @@
kind: Pod
apiVersion: v1
metadata:
name: pyserver
labels:
app: pyserver
spec:
containers:
- name: pyserver
image: localhost:5000/pyserver:0.1
---
kind: Service
apiVersion: v1
metadata:
name: pyserver
spec:
selector:
app: pyserver
ports:
# Port used by the Docker image
- port: 8080
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: pyserver-ingress
spec:
rules:
- http:
paths:
- path: /
backend:
serviceName: pyserver
servicePort: 8080
---