apiVersion: v1 kind: ConfigMap metadata: name: frontend-config namespace: vitrown-dev data: NODE_ENV: "production" VITE_API_BASE_URL: "https://api.vitrown.abrino.cloud" VITE_API_SOCKET_BASE_URL: "wss://api.vitrown.abrino.cloud" VITE_API_URL: "https://api.vitrown.abrino.cloud" VITE_SITE_URL: "https://vitrown.abrino.cloud" VITE_DOMAIN_URL: "https://vitrown.abrino.cloud" VITE_APP_VERSION_TYPE: "development" VITE_SUPPORT_PHONE: "+989223740993" VITE_BUILD_TARGET: "development" # Internal API URL for server-side requests (SSR) to avoid hairpin NAT issues INTERNAL_API_URL: "http://django-backend:8000" --- apiVersion: v1 kind: Secret metadata: name: frontend-secret namespace: vitrown-dev type: Opaque stringData: REMIX_SECRET: "dev-remix-secret-change-in-production-k8s-2024" --- apiVersion: apps/v1 kind: Deployment metadata: name: frontend namespace: vitrown-dev labels: app: frontend spec: replicas: 2 selector: matchLabels: app: frontend strategy: type: RollingUpdate rollingUpdate: maxSurge: 1 maxUnavailable: 0 template: metadata: labels: app: frontend spec: containers: - name: frontend image: harbor.abrino.cloud/sotoontech/vitron-frontend:dev-latest ports: - containerPort: 3000 name: http protocol: TCP envFrom: - configMapRef: name: frontend-config - secretRef: name: frontend-secret resources: requests: memory: "256Mi" cpu: "200m" limits: memory: "1Gi" cpu: "1000m" livenessProbe: httpGet: path: / port: 3000 initialDelaySeconds: 30 periodSeconds: 10 timeoutSeconds: 5 failureThreshold: 3 readinessProbe: httpGet: path: / port: 3000 initialDelaySeconds: 10 periodSeconds: 5 timeoutSeconds: 3 failureThreshold: 3 imagePullSecrets: - name: harbor-registry --- apiVersion: v1 kind: Service metadata: name: frontend namespace: vitrown-dev spec: selector: app: frontend ports: - protocol: TCP port: 3000 targetPort: 3000 type: ClusterIP --- # Horizontal Pod Autoscaler for Frontend apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: frontend-hpa namespace: vitrown-dev spec: scaleTargetRef: apiVersion: apps/v1 kind: Deployment name: frontend minReplicas: 2 maxReplicas: 4 metrics: - type: Resource resource: name: cpu target: type: Utilization averageUtilization: 70 - type: Resource resource: name: memory target: type: Utilization averageUtilization: 80 behavior: scaleDown: stabilizationWindowSeconds: 300 policies: - type: Percent value: 50 periodSeconds: 60 scaleUp: stabilizationWindowSeconds: 0 policies: - type: Percent value: 100 periodSeconds: 15