Skip to content

Kubernetes Deployment

gocron provides a Helm Chart for one-click deployment to Kubernetes clusters.

Prerequisites

  • Kubernetes 1.19+
  • Helm 3.0+

Installation

Add Helm Repository

bash
helm repo add gocron https://gocronx-team.github.io/gocron
helm repo update

Quick Install

bash
# Uses SQLite by default, minimal configuration
helm install gocron gocron/gocron

Custom Configuration

bash
# Method 1: Command line parameters
helm install gocron gocron/gocron \
  --set db.engine=mysql \
  --set db.host=mysql.default \
  --set db.port=3306 \
  --set db.user=gocron \
  --set db.password=your_password \
  --set db.database=gocron

# Method 2: Values file
helm install gocron gocron/gocron -f my-values.yaml

Upgrade

bash
helm upgrade gocron gocron/gocron --set image.tag=1.5.9

Uninstall

bash
helm uninstall gocron

Configuration

Image

ParameterDescriptionDefault
image.repositoryImage repositorygocronx/gocron
image.tagImage tagChart appVersion
image.pullPolicyPull policyIfNotPresent

Database

ParameterDescriptionDefault
db.engineDatabase type: sqlite, mysql, postgressqlite
db.hostDatabase host""
db.portDatabase port0
db.userDatabase user""
db.passwordDatabase password""
db.databaseDatabase name / SQLite file path./data/gocron.db
db.prefixTable prefix""
db.charsetCharacter setutf8
db.maxIdleConnsMax idle connections5
db.maxOpenConnsMax open connections100

Application

ParameterDescriptionDefault
app.nameApplication namegocron
app.apiKeyAPI Key""
app.apiSecretAPI Secret""
app.allowIpsAllowed IPs""
app.concurrencyQueueConcurrency queue size500
app.enableTlsEnable TLSfalse
timezoneTimezoneAsia/Shanghai

Service

ParameterDescriptionDefault
service.typeService typeClusterIP
service.portService port5920

Ingress

ParameterDescriptionDefault
ingress.enabledEnable Ingressfalse
ingress.classNameIngress Class""
ingress.annotationsAnnotations{}
ingress.hostsHost configuration[{host: gocron.local, paths: [{path: /, pathType: Prefix}]}]
ingress.tlsTLS configuration[]

Persistence

ParameterDescriptionDefault
persistence.enabledEnable persistencetrue
persistence.storageClassStorage class""
persistence.accessModeAccess modeReadWriteOnce
persistence.sizeStorage size1Gi

Resources

ParameterDescriptionDefault
resources.limits.cpuCPU limitnone
resources.limits.memoryMemory limitnone
resources.requests.cpuCPU requestnone
resources.requests.memoryMemory requestnone
replicaCountNumber of replicas1

Note

Replica count must be 1 when using SQLite, as SQLite does not support concurrent writes from multiple processes. Use MySQL or PostgreSQL for multiple replicas.

Deployment Examples

SQLite + NodePort

yaml
# values-sqlite.yaml
db:
  engine: sqlite

service:
  type: NodePort

persistence:
  enabled: true
  size: 2Gi

MySQL + Ingress

yaml
# values-mysql.yaml
db:
  engine: mysql
  host: mysql.database.svc
  port: 3306
  user: gocron
  password: your_password
  database: gocron

persistence:
  enabled: false

ingress:
  enabled: true
  className: nginx
  hosts:
    - host: gocron.example.com
      paths:
        - path: /
          pathType: Prefix
  tls:
    - secretName: gocron-tls
      hosts:
        - gocron.example.com

resources:
  requests:
    cpu: 100m
    memory: 128Mi
  limits:
    cpu: 500m
    memory: 256Mi

PostgreSQL + Multiple Replicas

yaml
# values-postgres.yaml
replicaCount: 3

db:
  engine: postgres
  host: pg.database.svc
  port: 5432
  user: gocron
  password: your_password
  database: gocron

persistence:
  enabled: false

Notes

  1. SQLite mode: Deployment strategy is automatically set to Recreate (instead of RollingUpdate) to prevent multiple Pods from accessing the SQLite file simultaneously
  2. Config changes: Pods automatically restart when ConfigMap changes (via checksum annotation)
  3. Data persistence: Always enable PVC in SQLite mode, otherwise data is lost when Pods restart
  4. Health checks: Liveness and readiness probes are configured by default, checking HTTP on port 5920