diff --git a/kubernetes-deploy.yml b/kubernetes-deploy.yml new file mode 100644 index 0000000..c647bfa --- /dev/null +++ b/kubernetes-deploy.yml @@ -0,0 +1,139 @@ +--- +kind: Namespace +apiVersion: v1 +metadata: + name: 5gproject + labels: + name: 5gproject +--- +apiVersion: v1 +kind: Secret +metadata: + name: regcred + namespace: 5gproject +data: + .dockerconfigjson: ewogICAgICAgICJhdXRocyI6IHsKICAgICAgICAgICAgICAgICJyZWdpc3RyeS5rbWxhYnouY29tIjogewogICAgICAgICAgICAgICAgICAgICAgICAiYXV0aCI6ICJkRzl5YldGcmNtbHpPbmx2Ykc5bmJtRnBjM2RoWjJWMGRHa3hMZz09IgogICAgICAgICAgICAgICAgfQogICAgICAgIH0KfQ== +type: kubernetes.io/dockerconfigjson +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: server + labels: + app: server + namespace: 5gproject +data: + REDIS_URL: "redis://redis:6379/0" +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: redis + namespace: 5gproject + labels: + app: redis +spec: + replicas: 1 + selector: + matchLabels: + app: redis + strategy: + type: Recreate + template: + metadata: + labels: + app: redis + spec: + containers: + - name: redis + image: redis + imagePullPolicy: Always + ports: + - containerPort: 6379 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: server + namespace: 5gproject + labels: + app: server +spec: + replicas: 1 + selector: + matchLabels: + app: server + strategy: + type: Recreate + template: + metadata: + labels: + app: server + spec: + containers: + - name: flask-app + image: registry.kmlabz.com/5gproject/server + imagePullPolicy: Always + envFrom: + - configMapRef: + name: server + ports: + - containerPort: 8080 + imagePullSecrets: + - name: regcred +--- +apiVersion: v1 +kind: Service +metadata: + name: redis + namespace: 5gproject + labels: + app: redis +spec: + ports: + - name: redis + port: 6379 + targetPort: 6379 + protocol: TCP + selector: + app: redis + type: ClusterIP +--- +apiVersion: v1 +kind: Service +metadata: + name: server + namespace: 5gproject + labels: + app: server +spec: + ports: + - name: flask + port: 80 + targetPort: 8080 + protocol: TCP + selector: + app: server + type: ClusterIP +--- +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + name: 5gproject + namespace: 5gproject + annotations: + kubernetes.io/ingress.class: "nginx" + cert-manager.io/cluster-issuer: "letsencrypt-prod" +spec: + tls: + - hosts: + - servicelocator.k8s.kmlabz.com + secretName: 5gproject-cert-secret + rules: + - host: servicelocator.k8s.kmlabz.com + http: + paths: + - path: / + backend: + serviceName: server + servicePort: flask \ No newline at end of file