- ERPNext now supports Kubernetes
- ERPNext Helm Chart
Installing ERPNext on MicroK8s
- Add ERPNext Helm chart repository
- Prepare Kubernetes
- Install frappe/erpnext Helm chart
- Create Resources
1. Add ERPNext Helm chart repository
kubectl config use-context microk8s helm repo add frappe https://helm.erpnext.com helm repo update
2. Prepare Kubernetes
This phase includes:
- LoadBalancer Service
- Certificate Management
- Shared Filesystem
2.1. LoadBalancer Service
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx helm install ingress-nginx ingress-nginx/ingress-nginx
2.3. MariaDB Installation
See ERPNext Helm chart > Prepare Kubernetes > MariaDB. Changes:
- tag: 10.4 (AWS RDS MariaDB already supports this per June 2020)
- For local development, set slave.replicas to 0.
- To install:
helm install -n mariadb mariadb bitnami/mariadb -f values-production.yaml
MariaDB Host should be mariadb.mariadb.svc.cluster.local.
2.4. Shared Filesystem
Save as nfs-server-provisioner-values.yaml: (you can change the size as you want)
persistence: enabled: true storageClass: "microk8s-hostpath" size: 8Gi storageClass: defaultClass: true
helm install nfs-server-provisioner stable/nfs-server-provisioner -f nfs-server-provisioner-values.yaml
Storage class to be used by ERPNext is “
Check if nfs-server-provisioner-0 pod is Running:
kubectl describe po nfs-server-provisioner-0 kubectl describe pvc data-nfs-server-provisioner-0 kubectl get pvc -A
3. Install frappe/erpnext Helm chart
Install ERPNext: (note: by default erpnext’s PVC persistence.size is 8Gi)
kubectl create namespace erpnext helm install frappe-bench-0001 --namespace erpnext frappe/erpnext \ --version 1.0.5 \ --set mariadbHost=mariadb.mariadb.svc.cluster.local \ --set persistence.storageClass=nfs
Note that erpnext pod contains 2 containers, but by default has pod
replicaCount of 1.
Ensure frappe-bench-0001-erpnext PVC is working/Bound:
ceefour@amanah:~/project/erpnext-local$ kubectl get pvc -A NAMESPACE NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE container-registry registry-claim Bound pvc-1f86ebc5-2239-4af1-8b84-28cd3e07e8d1 20Gi RWX microk8s-hostpath 59m default data-nfs-server-provisioner-0 Bound pvc-9529a0ff-329c-47d9-93e9-0f3af4d6bad2 1Gi RWO microk8s-hostpath 67s erpnext frappe-bench-0001-erpnext Bound pvc-3b96af59-60f8-469a-88c4-2de73e506a89 8Gi RWX nfs 15m mariadb data-mariadb-master-0 Bound pvc-95e4caf2-96be-4669-a639-798ca3b68b5f 8Gi RWO microk8s-hostpath 35m
You’ll get the following services:
ceefour@amanah:~/project/erpnext-local$ kubectl get svc -n erpnext NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE frappe-bench-0001-erpnext ClusterIP 10.152.183.19
80/TCP 14s frappe-bench-0001-erpnext-redis-cache ClusterIP 10.152.183.220 13000/TCP 14s frappe-bench-0001-erpnext-redis-queue ClusterIP 10.152.183.64 12000/TCP 14s frappe-bench-0001-erpnext-redis-socketio ClusterIP 10.152.183.165 11000/TCP 14s frappe-bench-0001-erpnext-socketio ClusterIP 10.152.183.152 9000/TCP 14s
Set the mariadb-root-password secret with key password:
kubectl create secret -n erpnext generic mariadb-root-password --from-literal=password=super_secret_password
Troubleshooting: Warning FailedMount 2m13s kubelet, amanah MountVolume.SetUp failed for volume “pvc-3b96af59-60f8-469a-88c4-2de73e506a89” : mount failed: exit status 32
Problem: This happens on erpnext describe pod (
kubectl describe po -n erpnext frappe-bench-0001-erpnext-erpnext-7bd5c94d46-lnv8m).
Solution: Hendy: For some reason, after I deleted the pod, then it works.
Post-install (No site yet)
You can open browser on service/frappe-bench-0001-erpnext’s Cluster IP on the same computer, e.g. http://10.152.183.171/ . You should get a “Sorry! We will be back soon.” message. Now you can create a Site and Ingress.
4. Create Resources
Reference: ERPNext Helm chart > Kubernetes Resources.
- Create New Site Job.
- Create New Site Ingress.
- Create CronJob to take backups and push them to cloud regularly.
4.1. Create New Site Job
apiVersion: batch/v1 kind: Job metadata: name: create-erp-example-com spec: backoffLimit: 1 template: spec: securityContext: supplementalGroups:  containers: - name: create-site image: frappe/erpnext-worker:v12.9.4 args: ["new"] imagePullPolicy: IfNotPresent volumeMounts: - name: sites-dir mountPath: /home/frappe/frappe-bench/sites env: - name: "SITE_NAME" value: erpnext-example.svc.cluster.local - name: "DB_ROOT_USER" value: root - name: "MYSQL_ROOT_PASSWORD" valueFrom: secretKeyRef: key: password name: mariadb-root-password - name: "ADMIN_PASSWORD" value: super_secret_password - name: "INSTALL_APPS" value: "erpnext" restartPolicy: Never volumes: - name: sites-dir persistentVolumeClaim: claimName: frappe-bench-0001-erpnext readOnly: false
kubectl create -n erpnext f add-example-site-job.yaml kubectl -n erpnext describe job create-erp-example-com
You’ll get a new Job pod for that site, e.g.
create-erp-example-com-c2wzv. You can follow logs on that site’s job: (this will take about 2 minutes, after that the pod’s status will go to Completed)
ceefour@amanah:~/project/erpnext-local$ kubectl logs -f -n erpnext create-erp-example-com-c2wzv Attempt 1 to connect to mariadb.mariadb.svc.cluster.local:3306 Attempt 1 to connect to frappe-bench-0001-erpnext-redis-queue:12000 Attempt 1 to connect to frappe-bench-0001-erpnext-redis-cache:13000 Attempt 1 to connect to frappe-bench-0001-erpnext-redis-socketio:11000 Connections OK Created user _684bfe87ae59e1a8 Created database _684bfe87ae59e1a8 Granted privileges to user _684bfe87ae59e1a8 and database _684bfe87ae59e1a8 Starting database import... Imported from database /home/frappe/frappe-bench/apps/frappe/frappe/database/mariadb/framework_mariadb.sql Installing frappe... Updating DocTypes for frappe : [========================================] Updating country info : [========================================] Installing erpnext... Updating DocTypes for erpnext : [========================================] Updating customizations for Address *** Scheduler is disabled ***
Now edit your
And open the browser at the
SITE_NAME, e.g. http://erpnext-example.svc.cluster.local/ . You should get a good welcome. 🙂 Congratulations! Login using user “
administrator” and the
ADMIN_PASSWORD that you’ve set before.
After logging in as administrator, you’ll need to set up your first company. After filling the forms, it’ll take some time to set up (about 2 minutes). You can follow kubectl logs for the erpnext pod to check progress, or to diagnose in case there’s an error.
- Distribution. The distribution domain is for companies and move product in some manner. This can be a retail establishment, but there is a dedicated domain for that. Distribution companies are often operate in a wholesale environment and don’t need point of sale (POS) type functionality, but do need to maintain stock and track sales and customers.
- Education. The education domain is for organizations that operate some kind of school or need to track students and other things for “classes”. This domain was recently renamed from Schools to Education.
- Manufacturing. The manufacturing domain is for companies that “make” things. There is a huge list of potential manufacturing companies out there, so the Admin guide is not going to attempt to give an exhaustive list. As as administrator for your organization or client, you will know if you need the manufacturing domain.
- Retail. The retail domain is for companies that sell things at “retail”. This is different than organizations the operate in the manufacturing or distribution domains. These companies operate in the “pre-retail” phase of production. Non-Profit organization quite often sell items “at retail” as part of their operations.
- Services. The services domain is for organizations that conduct professional services (i.e. Lawyers, Consultants). A lot of organizations, especially retail companies also have a services arm. This domain is often combined with retail, but not always.
- Agriculture. The agriculture domain is used for businesses that operate as agricultural companies such as farms, ranches, etc. This is a very new domain to the ERPNext platform and has not been documented very well to date.
- Healthcare. The healthcare domain is for companies that run clinics or other healthcare facilities that need a electronic medical record (EMR) system. This is a very new domain to the ERPNext platform and has not been documented very well to date.
- Non Profit. The non-profit domain is for organizations that operate as a special jurisdiction specific non-profit (non-taxable) entity. These are very special organizations that have much different needs that typical for-profit companies. The biggest difference is the need to track members, donors, volunteers, grants and other accounting specifics.
- Hospitality (beta). Manage multiple restaurants and hotels with table and room booking.
Lovia company (which includes Lovia Counseling, Lovia Jobs, Lovia Edu, Talentiva, Soluvas, and Every Child Learns) in ERPNext uses the following domains:
- Healthcare. We manage users as patients (which is linked to a customer as the payor, some patients like children can be linked to their parents as customers). We manage counselors as practitioners. We manage patient appointments, and consultations. We manage HR so we know how much to pay for each practitioner based on their consultations.
- Education. For Talentiva, we manage students (are they linked to customers?), programs (containing one or more courses), courses, student groups, instructors (I don’t think they’re linked to volunteers, but probably linked to users which should be linkable to volunteers).
- Non Profit. For the Every Child Learns cause, we manage members (cash donors & volunteers).
- Standard. We manage financial accounts (Accounts), customers and leads (CRM), sales invoices (Sales Orders), Human Resources, Fixed asset management, Project billing and cost center (e.g. for marketing and outreach campaigns).
- We plan to use Quality management.
- Sales Order
- Purchase Order
- Sales Invoice
- Student Group
- Student Attendance Tool
- Student Applicant
- BOM (Bill of Materials)
- Sales Order
- Purchase Order
- Production Order
- POS (Point of Sale)
- Sales Invoice
- Purchase Order
- Sales Order
- Sales Invoice
- CRM (Customer Relationship Management)
- Expense Claim
- Agriculture Task
- Crop Cycle
- Land Unit
- Plant Analysis
- Soil Analysis
- Soil Texture
- Water Analysis
- Patient Appointment
- Lab Test
Non Profit (Beta)
- Non Profit
- Grant Application
- Restaurant Menu
- Order Entry
- Hotel Room