What are steps for beginners to install ERPNext on Kubernetes?#

Install ingress controller. Cloud provider specific commands differ. Read more about kubernetes/ingress-nginx before installing.

kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.1.1/deploy/static/provider/cloud/deploy.yaml

Install Cert Manager and create Issuer or ClusterIssuer.

Install ERPNext

Generate Additional Resources to create site, ingress, backup jobs, etc.

What can be scaled?#

Frappe SocketIO, Background Workers (default, short, long), Gunicorn and Nginx Deployments can be scaled independently without any complexities involved.

Use following command to scale deployments.

$ kubectl scale -n <namespace> deployment <deployment-name> --replicas <number>

It is unsure whether scheduler can be scaled out. It is set to replica: 1 by default.

How to auto scale deployments?#

Use Horizontal Pod Autoscaler to auto scale required deployments.

Example to auto scale Deployment/frappe-bench-worker-d, apply following hpa.yaml.

# hpa.yaml
apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
  name: frappe-bench-worker-d
  maxReplicas: 5
  minReplicas: 1
    apiVersion: apps/v1
    kind: Deployment
    name: frappe-bench-worker-d
  targetCPUUtilizationPercentage: 60

Create the resource.

$ kubectl apply -n <namespace> -f hpa.yml

How do I edit files and directories on sites volume?#

Create file named volume-editor.yaml

kind: Pod
apiVersion: v1
  name: volume-editor
    - name: sites
        claimName: <CLAIM NAME GOES HERE>
    - name: debugger
      image: busybox
      # change ['sleep', 'infinity'] for pod to run infinitely
      command: ['sleep', '3600']
        - mountPath: "/data"
          name: sites

Change value for spec.volumes[0].claimName to <helm-release-name>-erpnext and create the resource in namespace where ERPNext is installed.

Change the container image as per the need or editor of your choice.

$ kubectl -n <namespace> -f volume-editor.yaml

Run an interactive shell inside the pod/container sites volume mounted at /data.

$ kubectl -n <namespace> exec -it volume-editor sh
/ #

delete the pod after use

$ kubectl -n <namespace> delete -f volume-editor.yaml

How do I upgrade and migrate to the latest helm release?#

Execute following command:

$ helm repo update
$ helm upgrade frappe-bench --namespace erpnext frappe/erpnext --set persistence.worker.storageClass=nfs

Generate resource to create site migration job

How do I customize values for the ERPNext helm chart?#

Download the values.yaml file locally and modify the content as per need. e.g. change socketIOImage.tag to edge and use the file to set values during helm install.

You may also use a custom image for your custom apps through the -f values.yaml or by using the --set <key>=<value> param.

$ wget -c https://raw.githubusercontent.com/frappe/helm/master/erpnext/values.yaml
$ code values.yaml
$ helm install <release-name> -n <namespace> frappe/erpnext -f values.yaml

How do I add custom domain to existing site?#

Example is using Kubernetes Nginx ingress annotations.

Create ingress resource with desired domain name with following annotation:

  nginx.ingress.kubernetes.io/upstream-vhost: main-site.example.com
  - host: custom-site.example.com