### Example Custom values.yaml for rqlite Source: https://github.com/rqlite/helm-charts/blob/master/charts/rqlite/README.md An example YAML configuration file for customizing the rqlite Helm chart deployment. It specifies the number of replicas, storage size, and resource requests. ```yaml replicaCount: 3 persistence: size: 50Gi resources: requests: cpu: 500m ``` -------------------------------- ### Install or Upgrade rqlite Release (Basic) Source: https://github.com/rqlite/helm-charts/blob/master/charts/rqlite/README.md Installs or upgrades a Helm release named 'rqlite' in the 'db' namespace, creating the namespace if it doesn't exist. This uses default chart values for a single-node deployment. ```bash helm upgrade -i -n db --create-namespace rqlite rqlite/rqlite ``` -------------------------------- ### Install Basic rqlite Cluster using Helm Source: https://context7.com/rqlite/helm-charts/llms.txt Installs a basic single-node rqlite cluster using the rqlite Helm chart. It first adds the rqlite Helm repository and then performs an upgrade/install operation in the 'db' namespace. The output shows how to verify the deployment by listing pods. ```bash # Add the rqlite Helm repository helm repo add rqlite https://rqlite.github.io/helm-charts # Install a basic single-node rqlite cluster in the 'db' namespace helm upgrade -i -n db --create-namespace rqlite rqlite/rqlite # Verify the deployment kubectl get pods -n db # NAME READY STATUS RESTARTS AGE # rqlite-0 1/1 Running 0 30s ``` -------------------------------- ### Install or Upgrade rqlite Release (Customized) Source: https://github.com/rqlite/helm-charts/blob/master/charts/rqlite/README.md Installs or upgrades a Helm release named 'rqlite' using a custom values file. This allows for more advanced configuration, such as setting replica count and persistence size. ```bash helm upgrade -i -n db --create-namespace rqlite rqlite/rqlite -f values.yaml ``` -------------------------------- ### Test Query Inside Cluster (Bash) Source: https://github.com/rqlite/helm-charts/blob/master/charts/rqlite/templates/NOTES.txt This bash command demonstrates how to issue a test query to rqlite from within the Kubernetes cluster. It uses curl to send a GET request to the service URL with a sample SQL query. ```bash curl -Gks {{ printf $curlcmd $svcurl }} ``` -------------------------------- ### Configure rqlite User Authentication with Helm Source: https://context7.com/rqlite/helm-charts/llms.txt Enables HTTP basic authentication for rqlite clusters by defining users and their permissions in the `values.yaml` file. The example shows how to configure an 'admin' user with all permissions, a 'readonly_user' with query permissions, and an 'app_user' with execute and query permissions. It also includes a bash command to test the authentication by executing a SQL query. ```yaml # values.yaml with user authentication config: users: - username: admin password: "supersecretpassword123" perms: [all] - username: readonly_user password: "readonlypass456" perms: [query] - username: app_user password: "appuserpass789" perms: [execute, query] ``` ```bash # Deploy with authentication enabled helm upgrade -i -n db rqlite rqlite/rqlite -f values.yaml # Test query with authentication from within the cluster kubectl exec -n db rqlite-0 -- curl -Gks -u admin:supersecretpassword123 \ 'http://127.0.0.1:4001/db/query?pretty' \ --data-urlencode 'q=SELECT sqlite_version()' # { # "results": [ # { # "columns": ["sqlite_version()"], # "values": [["3.45.0"]] # } # ] # } ``` -------------------------------- ### Deploy High-Availability rqlite Cluster with Helm Source: https://context7.com/rqlite/helm-charts/llms.txt Deploys a 3-node high-availability rqlite cluster with custom resource configurations. This can be done directly via command-line arguments using `--set` or by providing a `values.yaml` file. The example demonstrates setting replica count, persistence size, and resource requests for CPU and memory. ```bash # Deploy a 3-node HA cluster with custom values helm upgrade -i -n db --create-namespace rqlite rqlite/rqlite \ --set replicaCount=3 \ --set persistence.size=50Gi \ --set resources.requests.cpu=500m \ --set resources.requests.memory=256Mi # Alternatively, use a values file cat < values.yaml replicaCount: 3 persistence: size: 50Gi resources: requests: cpu: 500m memory: 256Mi EOF helm upgrade -i -n db --create-namespace rqlite rqlite/rqlite -f values.yaml ``` -------------------------------- ### Test Query Outside Cluster via Ingress (Bash) Source: https://github.com/rqlite/helm-charts/blob/master/charts/rqlite/templates/NOTES.txt This bash command shows how to test rqlite queries from outside the cluster using the configured ingress. It utilizes curl to send a GET request to the ingress URL with the same sample SQL query. ```bash curl -Gs {{ printf $curlcmd $.ingressurl }} ``` -------------------------------- ### Add rqlite Helm Repository Source: https://github.com/rqlite/helm-charts/blob/master/README.md This command adds the rqlite Helm chart repository to your local Helm configuration. This allows you to search for and install rqlite charts. Ensure Helm is installed before running this command. ```sh helm repo add rqlite https://rqlite.github.io/helm-charts ``` -------------------------------- ### Enable Client-Facing TLS for rqlite with Helm Source: https://context7.com/rqlite/helm-charts/llms.txt Configures HTTPS for client connections to the rqlite cluster by enabling client TLS in the `values.yaml` file. This can be done by embedding the certificate and key directly or by referencing a pre-existing Kubernetes TLS secret. The example includes a bash command to test the HTTPS connection. ```yaml # values.yaml with client TLS config: tls: client: enabled: true cert: | -----BEGIN CERTIFICATE----- MIIDkzCCAnugAwIBAgIUABC123... -----END CERTIFICATE----- key: | -----BEGIN PRIVATE KEY----- MIIEvgIBADANBgkqhkiG9w0BAQEF... -----END PRIVATE KEY----- # Or reference a pre-existing Kubernetes TLS secret config: tls: client: enabled: true secretName: rqlite-client-tls ``` ```bash # Deploy with TLS enabled helm upgrade -i -n db rqlite rqlite/rqlite -f values.yaml # Access via HTTPS (service defaults to port 443 when TLS enabled) kubectl exec -n db rqlite-0 -- curl -Gks \ 'https://127.0.0.1:4001/db/query?pretty' \ --data-urlencode 'q=SELECT 1' ``` -------------------------------- ### Configure MinIO Backup for Rqlite Source: https://context7.com/rqlite/helm-charts/llms.txt This configuration enables automatic backups to an S3-compatible storage like MinIO. It requires specifying access keys, bucket details, and endpoint information. The backup can be enabled automatically with a specified interval. ```yaml config: backup: storage: accessKeyId: cdRtR5mRJMvtMJz51Cts secretAccessKey: YY6RieQEwbbek3rhjOPwbwEUIkg8kYhhbxrL0h3R bucket: rqlite region: us-east-1 path: backups/production.sqlite.gz endpoint: https://s3.example.com forcePathStyle: true autoBackup: enabled: true interval: 30m vacuum: false noCompress: false timestamp: true autoRestore: enabled: true timeout: 5m continueOnFailure: false ``` -------------------------------- ### Format Curl Command for Querying (Helm) Source: https://github.com/rqlite/helm-charts/blob/master/charts/rqlite/templates/NOTES.txt This Helm template snippet formats the complete curl command for executing a database query. It combines the authentication options (if any) with the base URL and a sample SQL query. ```helm.mustache {{- $curlcmd := printf "%s'%%s/db/query?pretty' --data-urlencode 'q=select unixepoch(\"subsecond\")'" $curlopts -}} ``` -------------------------------- ### Deploy Rqlite with Ingress and Query via External Endpoint Source: https://context7.com/rqlite/helm-charts/llms.txt This command deploys rqlite with Ingress enabled, allowing external access. The subsequent command demonstrates querying the rqlite instance via the external ingress endpoint. ```bash # Deploy with Ingress helm upgrade -i -n db rqlite rqlite/rqlite -f values.yaml # Query via external ingress curl -Gs 'https://rqlite.example.com/db/query?pretty' \ -u admin:password \ --data-urlencode 'q=SELECT 1' ``` -------------------------------- ### Deploy Rqlite with Read-Only Pool and Query Endpoint Source: https://context7.com/rqlite/helm-charts/llms.txt This command deploys rqlite with a dedicated read-only node pool. The subsequent commands demonstrate how to query the read-only endpoint and dynamically scale the read-only pool. ```bash # Deploy with read-only pool helm upgrade -i -n db rqlite rqlite/rqlite -f values.yaml # Query the read-only endpoint (use consistency=none for local reads) kubectl exec -n db rqlite-readonly-0 -- curl -Gs \ 'http://127.0.0.1:4001/db/query?pretty&level=none' \ --data-urlencode 'q=SELECT * FROM mytable' # Scale read-only pool dynamically kubectl scale statefulset rqlite-readonly -n db --replicas=5 ``` -------------------------------- ### Configure Pod Scheduling for Rqlite Source: https://context7.com/rqlite/helm-charts/llms.txt This configuration demonstrates how to control the placement of rqlite pods using various Kubernetes scheduling features. It includes node selectors, tolerations, node affinity, pod anti-affinity, and topology spread constraints to ensure pods are scheduled optimally. ```yaml # values.yaml with scheduling configuration nodeSelector: node-type: database tolerations: - key: "database" operator: "Equal" value: "rqlite" effect: "NoSchedule" affinity: nodeAffinity: requiredDuringSchedulingIgnoredDuringExecution: nodeSelectorTerms: - matchExpressions: - key: kubernetes.io/arch operator: In values: [amd64, arm64] podAntiAffinity: preferredDuringSchedulingIgnoredDuringExecution: - weight: 100 podAffinityTerm: labelSelector: matchLabels: app.kubernetes.io/name: rqlite topologyKey: kubernetes.io/hostname topologySpreadConstraints: - topologyKey: topology.kubernetes.io/zone maxSkew: 1 whenUnsatisfiable: ScheduleAnyway labelSelector: matchLabels: app.kubernetes.io/name: '{{ template "rqlite.name" . }}' ``` -------------------------------- ### Deploy Rqlite with Automatic Backup Enabled Source: https://context7.com/rqlite/helm-charts/llms.txt This command deploys or upgrades the rqlite Helm chart with the specified values, enabling automatic backups. The subsequent command verifies the backup configuration within the rqlite pod. ```bash # Deploy with automatic backup enabled helm upgrade -i -n db rqlite rqlite/rqlite -f values.yaml # Verify backup configuration in pod kubectl exec -n db rqlite-0 -- cat /config/sensitive/backup.json ``` -------------------------------- ### Generate Authentication Options for Curl (Helm) Source: https://github.com/rqlite/helm-charts/blob/master/charts/rqlite/templates/NOTES.txt This Helm template snippet generates curl options for authentication if users are configured. It attempts to extract the first username and formats it for the curl command, defaulting to '' if no users are found or the username is missing. ```helm.mustache {{/* If auth is enabled, grab (somewhat randomly) the first username in the users list for the demo curl command. It's not guaranteed that user will have query permissions, but that's probably an edge case. */}} {{- $curlopts := (empty .Values.config.users) | ternary "" ( printf "-u %s: " (get (.Values.config.users | first) "username" | default "") ) }} ``` -------------------------------- ### Configure IRSA for Rqlite S3 Backup on AWS EKS Source: https://context7.com/rqlite/helm-charts/llms.txt This configuration snippet shows how to set up IAM Roles for Service Accounts (IRSA) on AWS EKS. This allows rqlite to access S3 buckets for backups without needing to manage static AWS credentials. ```yaml # values.yaml with IRSA configuration for S3 backup # Assumes an IAM role is already created and associated with the service account # For example: # iam.amazonaws.com/role-arn: "arn:aws:iam::123456789012:role/rqlite-s3-backup-role" serviceAccount: create: true name: rqlite-sa annotations: "iam.amazonaws.com/role-arn": "arn:aws:iam::123456789012:role/rqlite-s3-backup-role" ``` -------------------------------- ### Generate Ingress URL (Helm) Source: https://github.com/rqlite/helm-charts/blob/master/charts/rqlite/templates/NOTES.txt This Helm template snippet generates the URL for accessing rqlite via ingress. It constructs the URL using the host defined in the ingress configuration and a path derived from the ingress path setting. ```helm.mustache {{- $url := printf "https://%s%s" . (splitList "(" $.Values.ingress.path | first) -}} {{- $_ := set $ "ingressurl" $url -}} {{- $url | nindent 17 }} (ingress) ``` -------------------------------- ### Construct In-Cluster Service URL (Helm) Source: https://github.com/rqlite/helm-charts/blob/master/charts/rqlite/templates/NOTES.txt This Helm template snippet constructs the in-cluster service URL for rqlite. It determines the scheme (http or https) based on TLS client configuration and formats the URL using the release name, service name, and namespace. ```helm.mustache {{/* Construct URL for in-cluster access */}} {{- $scheme := .Values.config.tls.client.enabled | ternary "https" "http" }} {{- $svcurl := printf "%s://%s.%s.svc.cluster.local" $scheme $name .Release.Namespace }} ``` -------------------------------- ### Recover Rqlite Cluster from Quorum Loss using Static Peers Source: https://context7.com/rqlite/helm-charts/llms.txt This procedure outlines how to recover a rqlite cluster that has lost quorum by enabling static peers recovery mode. It involves enabling the mode, restarting nodes, and then critically disabling static peers to restore normal operation. ```bash # Step 1: Enable static peers recovery mode helm upgrade -n db rqlite rqlite/rqlite -f values.yaml --set useStaticPeers=true # Step 2: Rolling restart all nodes kubectl rollout -n db restart statefulset/rqlite statefulset/rqlite-readonly # Step 3: Wait for pods to stabilize kubectl rollout -n db status statefulset/rqlite # Step 4: Disable static peers (critical - don't skip this step) helm upgrade -n db rqlite rqlite/rqlite -f values.yaml # Verify cluster health kubectl exec -n db rqlite-0 -- curl -s 'http://127.0.0.1:4001/status?pretty' | grep -A5 '"store"' ``` -------------------------------- ### Scale Voting Nodes for Rqlite Cluster Source: https://context7.com/rqlite/helm-charts/llms.txt This section details how to scale the voting node cluster up or down. Scaling up involves increasing `replicaCount` and upgrading. Scaling down requires updating the chart and then manually removing nodes from the Raft cluster to maintain quorum. ```bash # Scale UP: Simply increase replicaCount and upgrade helm upgrade -n db rqlite rqlite/rqlite --set replicaCount=5 # Scale DOWN: First update the chart, then remove nodes from cluster # Step 1: Reduce StatefulSet replicas helm upgrade -n db rqlite rqlite/rqlite --set replicaCount=3 # Step 2: Remove the dropped nodes from the Raft cluster kubectl exec -n db rqlite-0 -ti -- /bin/sh ~ $ rqlite 127.0.0.1:4001> .remove rqlite-4 127.0.0.1:4001> .remove rqlite-3 127.0.0.1:4001> .exit # Note: Never remove more than ceiling(N/2)-1 nodes at once to maintain quorum ``` -------------------------------- ### Configure Kubernetes Ingress for Rqlite Source: https://context7.com/rqlite/helm-charts/llms.txt This configuration enables external access to rqlite via Kubernetes Ingress. It specifies Ingress class, hosts, paths, and TLS settings. A separate ingress configuration is provided for the read-only pool. ```yaml # values.yaml with Ingress configuration ingress: enabled: true ingressClassName: nginx hosts: - rqlite.example.com path: / pathType: Prefix annotations: cert-manager.io/cluster-issuer: letsencrypt-prod tls: - secretName: rqlite-tls hosts: - rqlite.example.com # Separate ingress for read-only pool readonly: replicaCount: 2 ingress: enabled: true ingressClassName: nginx hosts: - rqlite-readonly.example.com ``` -------------------------------- ### Configure Read-Only Node Pool for Rqlite Source: https://context7.com/rqlite/helm-charts/llms.txt This configuration defines a separate pool of read-only replicas to scale read workloads independently. It specifies the replica count and resource requests for these read-only nodes. ```yaml # values.yaml with read-only nodes replicaCount: 3 readonly: replicaCount: 2 resources: requests: cpu: 250m memory: 128Mi persistence: size: 20Gi ``` -------------------------------- ### Enable Inter-Node TLS for rqlite with Helm Source: https://context7.com/rqlite/helm-charts/llms.txt Configures TLS encryption for Raft consensus traffic between rqlite cluster nodes. This is enabled in the `values.yaml` file by setting `config.tls.node.enabled` to true. It supports specifying a server name to verify and enabling mutual TLS authentication using Kubernetes secrets for the node certificate/key and the CA certificate. ```yaml # values.yaml with inter-node TLS config: tls: node: enabled: true # SAN name that must appear in node certificates verifyServerName: rqlite.db.svc.cluster.local # Enable mutual TLS for node-to-node authentication mutual: true secretName: rqlite-node-tls caSecretName: rqlite-node-ca ``` ```bash # Create TLS secrets first (example using cert-manager or manual creation) kubectl create secret tls rqlite-node-tls -n db \ --cert=node.crt --key=node.key kubectl create secret generic rqlite-node-ca -n db \ --from-file=ca.crt=ca.crt # Deploy with inter-node TLS helm upgrade -i -n db rqlite rqlite/rqlite -f values.yaml ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.