├── Dockerfile ├── README.md ├── app.py ├── deployment.yaml └── requirements.txt /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.7 2 | RUN mkdir /app 3 | WORKDIR /app/ 4 | ADD . /app/ 5 | RUN pip install -r requirements.txt 6 | CMD ["python", "/app/app.py"] -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # kubernetes-deploy-tutorial 2 | This code is made for my youtube channel and corresponding to video given below. 3 | 4 | 5 |

6 | 7 | 8 | 9 |

10 | -------------------------------------------------------------------------------- /app.py: -------------------------------------------------------------------------------- 1 | from flask import Flask, jsonify 2 | import time 3 | app = Flask(__name__) 4 | 5 | @app.route("/") 6 | def hello(): 7 | return jsonify({"Time of Call": time.time()}) 8 | 9 | if __name__ == "__main__": 10 | app.run(host='0.0.0.0', debug=True) -------------------------------------------------------------------------------- /deployment.yaml: -------------------------------------------------------------------------------- 1 | apiVersion: v1 2 | kind: Service 3 | metadata: 4 | name: flask-test-service 5 | spec: 6 | selector: 7 | app: flask-test-app 8 | ports: 9 | - protocol: "TCP" 10 | port: 6000 11 | targetPort: 5000 12 | type: LoadBalancer 13 | 14 | --- 15 | apiVersion: apps/v1 16 | kind: Deployment 17 | metadata: 18 | name: flask-test-app 19 | spec: 20 | selector: 21 | matchLabels: 22 | app: flask-test-app 23 | replicas: 5 24 | template: 25 | metadata: 26 | labels: 27 | app: flask-test-app 28 | spec: 29 | containers: 30 | - name: flask-test-app 31 | image: flask-kubernetes 32 | imagePullPolicy: IfNotPresent 33 | ports: 34 | - containerPort: 5000 -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | flask --------------------------------------------------------------------------------