companion-kube.yaml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. apiVersion: v1
  2. kind: Service
  3. metadata:
  4. name: companion
  5. namespace: uppy
  6. labels:
  7. app: companion
  8. spec:
  9. ports:
  10. - port: 80
  11. targetPort: 3020
  12. protocol: TCP
  13. selector:
  14. app: companion
  15. ---
  16. apiVersion: apps/v1
  17. kind: StatefulSet
  18. metadata:
  19. name: companion
  20. namespace: uppy
  21. spec:
  22. selector:
  23. matchLabels:
  24. app: companion
  25. replicas: 2
  26. serviceName: "companion"
  27. template:
  28. metadata:
  29. labels:
  30. app: companion
  31. spec:
  32. affinity:
  33. nodeAffinity:
  34. requiredDuringSchedulingIgnoredDuringExecution:
  35. nodeSelectorTerms:
  36. - matchExpressions:
  37. - key: cloud.google.com/gke-preemptible
  38. operator: Exists
  39. podAntiAffinity:
  40. requiredDuringSchedulingIgnoredDuringExecution:
  41. - labelSelector:
  42. matchExpressions:
  43. - key: app
  44. operator: In
  45. values:
  46. - companion
  47. topologyKey: kubernetes.io/hostname
  48. containers:
  49. - image: docker.io/transloadit/companion:latest
  50. imagePullPolicy: Always
  51. name: companion
  52. envFrom:
  53. - configMapRef:
  54. name: uppy-companion-env
  55. ports:
  56. - containerPort: 3020
  57. volumeMounts:
  58. - name: companion-data
  59. mountPath: /mnt/companion-data
  60. volumeClaimTemplates:
  61. - metadata:
  62. name: companion-data
  63. spec:
  64. accessModes: [ "ReadWriteOnce" ]
  65. storageClassName: "standard"
  66. resources:
  67. requests:
  68. storage: 10Gi
  69. ---
  70. apiVersion: extensions/v1beta1
  71. kind: Ingress
  72. metadata:
  73. name: companion
  74. namespace: uppy
  75. annotations:
  76. kubernetes.io/tls-acme: "true"
  77. kubernetes.io/ingress.class: "nginx"
  78. certmanager.k8s.io/cluster-issuer: "letsencrypt-prod"
  79. certmanager.k8s.io/acme-http01-edit-in-place: "true"
  80. nginx.ingress.kubernetes.io/affinity: "cookie"
  81. nginx.ingress.kubernetes.io/session-cookie-name: "route"
  82. nginx.ingress.kubernetes.io/session-cookie-hash: "sha1"
  83. spec:
  84. tls:
  85. - secretName: server-tls
  86. hosts:
  87. - companion.uppy.io
  88. - server.uppy.io
  89. rules:
  90. - host: server.uppy.io
  91. http:
  92. paths:
  93. - path: /
  94. backend:
  95. serviceName: companion
  96. servicePort: 80
  97. - host: companion.uppy.io
  98. http:
  99. paths:
  100. - path: /
  101. backend:
  102. serviceName: companion
  103. servicePort: 80
  104. ---
  105. apiVersion: autoscaling/v1
  106. kind: HorizontalPodAutoscaler
  107. metadata:
  108. name: companion
  109. namespace: uppy
  110. spec:
  111. scaleTargetRef:
  112. apiVersion: apps/v1
  113. kind: Statefulset
  114. name: companion
  115. minReplicas: 1
  116. maxReplicas: 5
  117. targetCPUUtilizationPercentage: 80