Skip to main content

(Optional) Try with K8s Helm

Introduction

Now we show how to deploy Casdoor on Kubernetes using Helm for easy and scalable management.

Prerequisites

  • A running Kubernetes cluster
  • Helm v3 installed

Installation Steps

Step 1: Install the Casdoor Chart

Install the Casdoor chart:

helm install casdoor oci://registry-1.docker.io/casbin/casdoor-helm-charts --version v1.702.0

Step 2: Accessing Casdoor

Once installed, Casdoor can be accessed at the provided service URL by your Kubernetes cluster.

Customization and Configuration

Customize your Casdoor installation by modifying the Helm chart values. For detailed options, refer to the values.yaml file in the chart. The following parameters can be configured.

ParameterDescriptionDefault Value
replicaCountNumber of replicas of the Casdoor application to run.1
image.repositoryRepository for the Casdoor Docker image.casbin
image.nameName of the Casdoor Docker image.casdoor
image.pullPolicyPull policy for the Casdoor Docker image.IfNotPresent
image.tagTag for the Casdoor Docker image.""
configConfiguration settings for the Casdoor application.See config field
database.driverDatabase driver to use (supports mysql, postgres, cockroachdb, sqlite3).sqlite3
database.userDatabase username.""
database.passwordDatabase password.""
database.hostDatabase host.""
database.portDatabase port.""
database.databaseNameName of the database used by Casdoor.casdoor
database.sslModeSSL mode for the database connection.disable
service.typeType of Kubernetes service to create for Casdoor (ClusterIP, NodePort, LoadBalancer, etc.).ClusterIP
service.portPort number for the Casdoor service.8000
ingress.enabledWhether to enable Ingress for Casdoor.false
ingress.annotationsAnnotations for the Ingress resource.{}
ingress.hostsHostnames for the Ingress resource.[]
resourcesResource requests and limits for the Casdoor container.{}
autoscaling.enabledWhether to enable Horizontal Pod Autoscaler for Casdoor.false
autoscaling.minReplicasMinimum number of replicas for Horizontal Pod Autoscaler.1
autoscaling.maxReplicasMaximum number of replicas for Horizontal Pod Autoscaler.100
autoscaling.targetCPUUtilizationPercentageTarget CPU utilization percentage for Horizontal Pod Autoscaler.80
nodeSelectorNode labels for pod assignment.{}
tolerationsToleration labels for pod assignment.[]
affinityAffinity settings for pod assignment.{}
extraContainersEnabledWhether to enable additional sidecar containers.false
extraContainersAdditional sidecar containers.""
extraVolumeMountsAdditional volume mounts for the Casdoor container.[]
extraVolumesAdditional volumes for the Casdoor container.[]
envFromSecretProvide Environment variable from secret.[{name:"",secretName:"",key:""}]
envFromConfigmapProvide Environment variable from configmap.[{name:"",configmapName:"",key:""}]
envFromProvide Environment variable from entire secret or configmap.[{name:"",type:"configmap \| secret"}]

Managing the Deployment

To upgrade your Casdoor deployment:

helm upgrade casdoor casdoor/casdoor-helm-charts

To uninstall Casdoor:

helm delete casdoor

For further management and customization, refer to the Helm and Kubernetes documentation.

Conclusion

Using Helm to deploy Casdoor on Kubernetes simplifies the management and scalability of your authentication services within your Kubernetes environment.