Перейти до основного вмісту

Try with Helm

This page describes how to deploy Casdoor on Kubernetes using Helm.

Передумови

  • A running Kubernetes cluster (1.19+)
  • Helm v3.8+

Installation

Step 1: Install the Casdoor chart

Install the Casdoor Helm chart:

helm install casdoor oci://registry-1.docker.io/casbin/casdoor-helm-charts --version <version>

To install with a custom values file:

helm install casdoor oci://registry-1.docker.io/casbin/casdoor-helm-charts \
--version <version> \
-f my-values.yaml

Step 2: Access Casdoor

After installation, use the service URL provided by your cluster to access Casdoor.

Customization

Override values.yaml to customize the deployment. Key parameters:

ПараметрОписЗначення за замовчуванням
replicaCountКількість реплік додатку Casdoor для запуску.1
image.repositoryРепозиторій для Docker-образу Casdoor.casbin
image.nameНазва Docker-образу Casdoor.casdoor
image.pullPolicyПолітика завантаження для Docker-образу Casdoor.IfNotPresent
image.tagТег для Docker-образу Casdoor.""
configНалаштування конфігурації для додатку Casdoor.See values.yaml
database.driverDatabase driver to use (mysql, postgres, cockroachdb, sqlite).sqlite
database.userІм'я користувача бази даних.""
database.passwordПароль бази даних.""
database.hostХост бази даних.""
database.portПорт бази даних.""
database.databaseNameНазва бази даних, яку використовує Casdoor.casdoor
database.sslModeРежим SSL для з'єднання з базою даних.disable
service.typeType of Kubernetes service (ClusterIP, NodePort, LoadBalancer).ClusterIP
service.portНомер порту для сервісу Casdoor.8000
ingress.enabledЧи включити Ingress для Casdoor.false
ingress.annotationsАнотації для ресурсу Ingress.{}
ingress.hostsІмена хостів для ресурсу Ingress.[]
resourcesЗапити ресурсів та ліміти для контейнера Casdoor.{}
autoscaling.enabledЧи включити Horizontal Pod Autoscaler для Casdoor.false
autoscaling.minReplicasMinimum number of replicas for HPA.1
autoscaling.maxReplicasMaximum number of replicas for HPA.100
autoscaling.targetCPUUtilizationPercentageTarget CPU utilization percentage for HPA.80
nodeSelectorМітки вузлів для призначення подів.{}
tolerationsМітки толерації для призначення подів.[]
affinityНалаштування афінності для призначення подів.{}
extraContainersEnabledЧи включити додаткові контейнери sidecar.false
extraContainersДодаткові контейнери sidecar.""
extraVolumeMountsДодаткові монтування томів для контейнера Casdoor.[]
extraVolumesДодаткові томи для контейнера Casdoor.[]
envFromSecretEnvironment variables from individual Secret keys.[]
envFromConfigmapEnvironment variables from individual ConfigMap keys.[]
envFromEnvironment variables from entire Secrets or ConfigMaps.[]

Exposing Casdoor

Option 1: Ingress (classic)

Enable and configure Ingress:

ingress:
enabled: true
className: nginx
annotations:
cert-manager.io/cluster-issuer: letsencrypt-prod
hosts:
- host: casdoor.example.com
paths:
- path: /
pathType: Prefix
tls:
- secretName: casdoor-tls
hosts:
- casdoor.example.com

Option 2: Gateway API (modern)

The Kubernetes Gateway API is the next-generation successor to Ingress, officially GA since Kubernetes 1.31. It is supported by Istio, Envoy Gateway, Cilium, Kong, NGINX Gateway Fabric, and others.

порада

Prerequisites

kubectl apply -f https://github.com/kubernetes-sigs/gateway-api/releases/download/v1.2.0/standard-install.yaml

You also need a compatible Gateway controller running in your cluster.

Attach to an existing Gateway

If you already have a Gateway resource in your cluster, point the HTTPRoute at it:

gatewayApi:
enabled: true
parentRefs:
- name: my-gateway
namespace: gateway-system
sectionName: https
hostnames:
- casdoor.example.com

Create a new Gateway (e.g. with Istio)

Let the chart create a Gateway and HTTPRoute together:

gatewayApi:
enabled: true
createGateway: true
hostnames:
- casdoor.example.com
gateway:
gatewayClassName: istio
listeners:
- name: http
protocol: HTTP
port: 80
allowedRoutes:
namespaces:
from: Same

Create a Gateway with HTTP→HTTPS redirect

Enable TLS termination and automatic HTTP-to-HTTPS redirect:

gatewayApi:
enabled: true
createGateway: true
hostnames:
- casdoor.example.com
gateway:
gatewayClassName: istio
listeners:
- name: http
protocol: HTTP
port: 80
allowedRoutes:
namespaces:
from: Same
- name: https
protocol: HTTPS
port: 443
tls:
certificateRefs:
- name: casdoor-tls
kind: Secret
allowedRoutes:
namespaces:
from: Same
httpsRedirect:
enabled: true

Gateway API parameters

ParameterDescriptionDefault
gatewayApi.enabledEnable HTTPRoute creationfalse
gatewayApi.createGatewayAlso create a Gateway resourcefalse
gatewayApi.annotationsAnnotations for the HTTPRoute{}
gatewayApi.labelsExtra labels for the HTTPRoute{}
gatewayApi.parentRefsParent Gateway references[]
gatewayApi.hostnamesHostnames to match (Host header)[]
gatewayApi.rulesRouting rules (matches, filters, backendRefs)PathPrefix /
gatewayApi.gateway.nameGateway name (defaults to chart fullname)""
gatewayApi.gateway.gatewayClassNameGatewayClass name (required when createGateway=true)""
gatewayApi.gateway.listenersGateway listenersHTTP:80
gatewayApi.httpsRedirect.enabledEnable HTTP→HTTPS redirect HTTPRoutefalse
gatewayApi.httpsRedirect.statusCodeRedirect response code301
gatewayApi.httpsRedirect.hostnamesHostnames for redirect route[]
gatewayApi.httpsRedirect.parentRefsOverride parentRefs for redirect route[]

Managing the deployment

Upgrade:

helm upgrade casdoor oci://registry-1.docker.io/casbin/casdoor-helm-charts --version <version>

Uninstall:

helm uninstall casdoor

For more options, see the Helm and Kubernetes documentation.