https://www.growthbook.io/ logo
#give-feedback
Title
# give-feedback
m

miniature-france-97575

01/19/2022, 5:36 PM
Simple Deployment to Kubernetes using
nginx-ingress
and
cert-manager
- just sharing here
Copy code
apiVersion: apps/v1
kind: Deployment
metadata:
  name: growthbook-web
  labels:
    app: growthbook-web
spec:
  replicas: 1
  selector:
    matchLabels:
      app: growthbook-web
  template:
    metadata:
      labels:
        app: growthbook-web
    spec:
      containers:
        - name: growthbook-web
          image: growthbook/growthbook:latest
          env:
            - name: APP_ORIGIN
              value: <https://growthbook>.<DOMAIN_NAME>
            - name: API_HOST
              value: <https://growthbook-api>.<DOMAIN_NAME>
            - name: MONGODB_URI
              value: <mongodb://root:password@growthbook-mongo.default:27017>
          ports:
            - containerPort: 3000
              name: web
            - containerPort: 3100
              name: api
---
apiVersion: v1
kind: Service
metadata:
  name: growthbook-web
spec:
  ports:
    - name: web
      port: 3000
      targetPort: 3000
    - name: api
      port: 3100
      targetPort: 3100
  selector:
    app: growthbook-web
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: growthbook-mongo
  labels:
    app: growthbook-mongo
spec:
  replicas: 1
  selector:
    matchLabels:
      app: growthbook-mongo
  template:
    metadata:
      labels:
        app: growthbook-mongo
    spec:
      containers:
        - name: growthbook-mongo
          image: mongo:latest
          env:
            - name: MONGO_INITDB_ROOT_USERNAME
              value: root
            - name: MONGO_INITDB_ROOT_PASSWORD
              value: password
          ports:
            - containerPort: 27017
---
apiVersion: v1
kind: Service
metadata:
  name: growthbook-mongo
spec:
  ports:
    - name: web
      port: 27017
      targetPort: 27017
  selector:
    app: growthbook-mongo
  type: ClusterIP
---
apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: Ingress
metadata:
  annotations:
    <http://cert-manager.io/cluster-issuer|cert-manager.io/cluster-issuer>: letsencrypt
    <http://nginx.ingress.kubernetes.io/proxy-connect-timeout|nginx.ingress.kubernetes.io/proxy-connect-timeout>: "300"
    <http://nginx.ingress.kubernetes.io/proxy-read-timeout|nginx.ingress.kubernetes.io/proxy-read-timeout>: "300"
    <http://nginx.ingress.kubernetes.io/proxy-send-timeout|nginx.ingress.kubernetes.io/proxy-send-timeout>: "300"
  labels:
    app: growthbook-web
  name: growthbook-web
spec:
  ingressClassName: nginx
  rules:
    - host: growthbook.<DOMAIN_NAME>
      http:
        paths:
          - backend:
              service:
                name: growthbook-web
                port:
                  name: web
            path: /
            pathType: ImplementationSpecific
  tls:
    - hosts:
        - growthbook.<DOMAIN_NAME>
      secretName: growthbook-letsencrypt
---
apiVersion: <http://networking.k8s.io/v1|networking.k8s.io/v1>
kind: Ingress
metadata:
  annotations:
    <http://cert-manager.io/cluster-issuer|cert-manager.io/cluster-issuer>: letsencrypt
    <http://nginx.ingress.kubernetes.io/proxy-connect-timeout|nginx.ingress.kubernetes.io/proxy-connect-timeout>: "300"
    <http://nginx.ingress.kubernetes.io/proxy-read-timeout|nginx.ingress.kubernetes.io/proxy-read-timeout>: "300"
    <http://nginx.ingress.kubernetes.io/proxy-send-timeout|nginx.ingress.kubernetes.io/proxy-send-timeout>: "300"
  labels:
    app: growthbook-api
  name: growthbook-api
spec:
  ingressClassName: nginx
  rules:
    - host: growthbook-api.<DOMAIN_NAME>
      http:
        paths:
          - backend:
              service:
                name: growthbook-web
                port:
                  name: api
            path: /
            pathType: ImplementationSpecific
  tls:
    - hosts:
        - growthbook-api.<DOMAIN_NAME>
      secretName: growthbook-api-letsencrypt
🙌 1
f

fresh-football-47124

01/19/2022, 5:40 PM
nice, thanks
e

early-battery-30877

01/20/2022, 11:26 PM
@wonderful-country-42864 ^^ This might make our life lots, lots easier 😛
m

miniature-france-97575

01/21/2022, 3:35 PM
yes, just make sure you have the nginx/cert-manager for the ingress part.
466 Views