### Start Example Solr Cloud Cluster Source: https://github.com/apache/solr-operator/blob/main/docs/local_tutorial.md Deploys a 3-node Solr Cloud cluster with specified Java memory settings, external addressability, and ingress class. Ensure your domain is correctly configured for external access. ```bash # Create a 3-node cluster v9.10.0 with 300m Heap each: helm install example-solr apache-solr/solr --version 0.10.0-prerelease \ --set image.tag=9.10.0 \ --set solrOptions.javaMemory="-Xms300m -Xmx300m" \ --set addressability.external.method=Ingress \ --set addressability.external.domainName="ing.local.domain" \ --set addressability.external.useExternalAddress="true" \ --set ingressOptions.ingressClassName="nginx" ``` ```bash # The solr-operator has created a new resource type 'solrclouds' which we can query # Check the status live as the deploy happens kubectl get solrclouds -w ``` ```bash # Open a web browser to see a solr node: # Note that this is the service level, so will round-robin between the nodes open "http://default-example-solrcloud.ing.local.domain/solr/#/~cloud?view=nodes" ``` -------------------------------- ### Install Kubernetes Dashboard Source: https://github.com/apache/solr-operator/blob/main/docs/local_tutorial.md Install the Kubernetes Dashboard for a web-based overview of your cluster. This step is optional if you are comfortable with the command line. ```bash # Install the Dashboard kubectl apply -f https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.4/aio/deploy/recommended.yaml ``` -------------------------------- ### Start Kube-Proxy and Open Dashboard Source: https://github.com/apache/solr-operator/blob/main/docs/local_tutorial.md Start a kube-proxy in the background to enable access to the dashboard and then open the dashboard in your browser using the provided URL. ```bash # Start a kube-proxy in the background (it will listein on localhost:8001) kubectl proxy & # Open a browser to the dashboard (note, this is one long URL) open "http://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/#/overview?namespace=default" ``` -------------------------------- ### Install Homebrew, Docker, and Helm Source: https://github.com/apache/solr-operator/blob/main/docs/local_tutorial.md Installs Homebrew, Docker Desktop, and Helm, which are prerequisites for setting up Solr on Kubernetes. Ensure Kubernetes is enabled in Docker settings. ```bash # Install Homebrew, if you don't have it already /bin/bash -c "$(curl -fsSL \ https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" # Install Docker Desktop for Mac (use edge version to get latest k8s) brew install --cask docker # Enable Kubernetes in Docker Settings, or run the command below: sed -i -e 's/"kubernetesEnabled": false/"kubernetesEnabled": true/g' \ ~/Library/Group\ Containers/group.com.docker/settings.json # Start Docker for mac from Finder, or run the command below open /Applications/Docker.app # Install Helm, which we'll use to install the operator, and 'watch' brew install helm watch ``` -------------------------------- ### Install Prometheus Stack with Helm Source: https://context7.com/apache/solr-operator/llms.txt Install the Prometheus Operator stack using Helm. This sets up Prometheus, Alertmanager, Grafana, and other components for monitoring. ```bash helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm repo update kubectl create ns monitoring helm upgrade --install mon prometheus-community/kube-prometheus-stack \ --namespace monitoring \ --set kubeStateMetrics.enabled=false \ --set nodeExporter.enabled=false ``` -------------------------------- ### Install Prometheus Stack with Helm Source: https://github.com/apache/solr-operator/blob/main/docs/solr-prometheus-exporter/README.md Installs the Prometheus Stack using Helm, disabling kube-state-metrics and node-exporter. Ensure the prometheus-community repo is added. ```bash MONITOR_NS=monitoring PROM_OPER_REL=mon kubectl create ns ${MONITOR_NS} # see: https://github.com/prometheus-community/helm-charts/tree/main/charts/kube-prometheus-stack if ! helm repo list | grep -q "https://prometheus-community.github.io/helm-charts"; then echo -e "\nAdding the prometheus-community repo to helm" helm repo add prometheus-community https://prometheus-community.github.io/helm-charts helm repo add stable https://charts.helm.sh/stable helm repo update fi helm upgrade --install ${PROM_OPER_REL} prometheus-community/kube-prometheus-stack \ --namespace ${MONITOR_NS} \ --set kubeStateMetrics.enabled=false \ --set nodeExporter.enabled=false ``` -------------------------------- ### Install Solr Operator Dependencies Source: https://github.com/apache/solr-operator/blob/main/docs/development.md Installs necessary dependencies for building and deploying the operator. Ensure your GOPATH is set and exported. ```bash export PATH="$PATH:$GOPATH/bin" # You likely want to add this line to your ~/.bashrc or ~/.bash_aliases make install-dependencies ``` -------------------------------- ### Install Cert-Manager with Helm Source: https://github.com/apache/solr-operator/blob/main/docs/solr-cloud/solr-cloud-crd.md Installs cert-manager using Helm, including its CRDs. Ensure the Helm repository is added and updated first. This requires admin privileges for CRD installation. ```bash if ! helm repo list | grep -q "https://charts.jetstack.io"; then helm repo add jetstack https://charts.jetstack.io helm repo update fi kubectl create ns cert-manager helm upgrade --install cert-manager jetstack/cert-manager \ --namespace cert-manager \ --version v1.1.0 \ --set installCRDs=true ``` -------------------------------- ### Install Apache Solr Operator v0.3.0 Source: https://github.com/apache/solr-operator/blob/main/docs/upgrading-to-apache.md Installs the Apache Solr Operator using Helm version 0.3.0. ```bash helm install apache apache-solr/solr-operator --version 0.3.0 ``` -------------------------------- ### Install Solr and Zookeeper Operators Source: https://github.com/apache/solr-operator/blob/main/docs/local_tutorial.md Installs the Solr and Zookeeper Operators using Helm. Note that the Helm chart version does not use a 'v' prefix. ```bash $ helm install solr-operator apache-solr/solr-operator --version 0.10.0-prerelease ``` -------------------------------- ### Install Solr Operator via Helm Source: https://context7.com/apache/solr-operator/llms.txt Installs the Solr Operator and its dependencies using Helm. Ensure CRDs are applied before installation or upgrade. ```bash # Add the Helm repository helm repo add apache-solr https://solr.apache.org/charts helm repo update # Install CRDs (including ZookeeperCluster CRD) kubectl create -f https://solr.apache.org/operator/downloads/crds/v0.10.0-prerelease/all-with-dependencies.yaml # Install the Solr Operator (watches all namespaces by default) helm install solr-operator apache-solr/solr-operator --version 0.10.0-prerelease # Watch a specific namespace only helm install solr-operator apache-solr/solr-operator \ --namespace solr \ --set watchNamespaces=solr \ --version 0.10.0-prerelease # Upgrade (always replace CRDs first) kubectl replace -f https://solr.apache.org/operator/downloads/crds/v0.10.0-prerelease/all-with-dependencies.yaml helm upgrade solr-operator apache-solr/solr-operator --version 0.10.0-prerelease ``` -------------------------------- ### Install Solr Operator in Multiple Namespaces Source: https://context7.com/apache/solr-operator/llms.txt Install the Solr Operator in a specific namespace, skipping CRD installation to avoid conflicts with a cluster-wide installation. Configure watched namespaces using the `watchNamespaces` parameter. ```bash helm install solr-operator apache-solr/solr-operator \ --skip-crds \ --namespace solr-ns2 \ --set watchNamespaces=solr-ns2 ``` -------------------------------- ### Example CRD URLs Source: https://github.com/apache/solr-operator/blob/main/docs/running-the-operator.md Provides examples of URLs for downloading Solr CRDs for different versions and scopes, including all CRDs or specific ones like SolrCloud. ```text https://solr.apache.org/operator/downloads/crds/v0.3.0/all.yaml https://solr.apache.org/operator/downloads/crds/v0.2.7/all-with-dependencies.yaml https://solr.apache.org/operator/downloads/crds/v0.2.8/solrclouds.yaml ``` -------------------------------- ### Install Nginx Ingress Controller Source: https://github.com/apache/solr-operator/blob/main/docs/local_tutorial.md Applies the Nginx ingress controller to make Kubernetes services accessible from your laptop. Inspect the installation and update your /etc/hosts file. ```bash # Install the nginx ingress controller kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/master/deploy/static/provider/cloud/deploy.yaml # Inspect that the ingress controller is running by visiting the Kubernetes dashboard # and selecting namespace `ingress-nginx`, or running this command: kubectl get all --namespace ingress-nginx # Edit your /etc/hosts file (`sudo vi /etc/hosts`) and replace the 127.0.0.1 line with: 127.0.0.1 localhost default-example-solrcloud.ing.local.domain ing.local.domain default-example-solrcloud-0.ing.local.domain default-example-solrcloud-1.ing.local.domain default-example-solrcloud-2.ing.local.domain dinghy-ping.localhost ``` -------------------------------- ### Get SolrBackup Status with Kubectl Source: https://github.com/apache/solr-operator/blob/main/docs/solr-backup/README.md Use kubectl to retrieve the status of SolrBackup resources, including start time, completion status, and the next scheduled backup time. ```bash $ kubectl get solrbackups NAME CLOUD STARTED FINISHED SUCCESSFUL NEXTBACKUP AGE test example 123m true true 2021-11-09T00:00:00Z 161m ``` -------------------------------- ### Install Solr Cloud with Helm Source: https://github.com/apache/solr-operator/blob/main/helm/solr/README.md Installs a SolrCloud object on the Kubernetes cluster with default configuration. The Solr Operator manages the creation of necessary Kubernetes resources. ```bash helm install example apache-solr/solr --version 0.10.0-prerelease --set image.tag=9.10.0 ``` -------------------------------- ### Check SolrBackup Status Source: https://github.com/apache/solr-operator/blob/main/docs/solr-backup/README.md Use kubectl to get the status of SolrBackup resources, including start time, completion status, and age. ```bash $ kubectl get solrbackups NAME CLOUD STARTED FINISHED SUCCESSFUL NEXTBACKUP AGE test example 123m true false 161m ``` -------------------------------- ### List All Kubernetes Resources Source: https://github.com/apache/solr-operator/blob/main/docs/solr-cloud/dependencies.md Use 'kubectl get all' to view all resources associated with a Solr Cloud deployment, including pods, services, deployments, statefulsets, and ingress. ```bash $ kubectl get all NAME READY STATUS RESTARTS AGE pod/example-solrcloud-0 1/1 Running 7 47h pod/example-solrcloud-1 1/1 Running 6 47h pod/example-solrcloud-2 1/1 Running 0 47h pod/example-solrcloud-3 1/1 Running 6 47h pod/example-solrcloud-zk-0 1/1 Running 0 49d pod/example-solrcloud-zk-1 1/1 Running 0 49d pod/example-solrcloud-zk-2 1/1 Running 0 49d pod/example-solrcloud-zk-3 1/1 Running 0 49d pod/example-solrcloud-zk-4 1/1 Running 0 49d pod/solr-operator-8449d4d96f-cmf8p 1/1 Running 0 47h pod/zk-operator-674676769c-gd4jr 1/1 Running 0 49d NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE service/example-solrcloud-0 ClusterIP ##.###.###.## 80/TCP 47h service/example-solrcloud-1 ClusterIP ##.###.##.# 80/TCP 47h service/example-solrcloud-2 ClusterIP ##.###.###.## 80/TCP 47h service/example-solrcloud-3 ClusterIP ##.###.##.### 80/TCP 47h service/example-solrcloud-common ClusterIP ##.###.###.### 80/TCP 47h service/example-solrcloud-headless ClusterIP None 8983/TCP 47h service/example-solrcloud-zk-client ClusterIP ##.###.###.### 21210/TCP 49d service/example-solrcloud-zk-headless ClusterIP None 22210/TCP,23210/TCP 49d NAME READY UP-TO-DATE AVAILABLE AGE deployment.apps/solr-operator 1/1 1 1 49d deployment.apps/zk-operator 1/1 1 1 49d NAME DESIRED CURRENT READY AGE replicaset.apps/solr-operator-8449d4d96f 1 1 1 2d1h replicaset.apps/zk-operator-674676769c 1 1 1 49d NAME READY AGE statefulset.apps/example-solrcloud 4/4 47h statefulset.apps/example-solrcloud-zk 5/5 49d NAME HOSTS PORTS AGE ingress.extensions/example-solrcloud-common default-example-solrcloud.test.domain,default-example-solrcloud-0.test.domain + 3 more... 80 2d2h NAME VERSION DESIREDNODES NODES READYNODES AGE solrcloud.solr.apache.org/example 8.1.1 4 4 4 47h ``` -------------------------------- ### Install Solr Operator in Specific Namespace Source: https://github.com/apache/solr-operator/blob/main/helm/solr-operator/README.md Installs the Solr Operator into a specified Kubernetes namespace. ```bash helm install solr-operator apache-solr/solr-operator --namespace solr ``` -------------------------------- ### Convert Solr Resources from bloomberg.com to apache.org Source: https://github.com/apache/solr-operator/blob/main/docs/upgrading-to-apache.md Converts SolrCloud, SolrPrometheusExporter, and SolrBackup resources from the `solr.bloomberg.com` API group to `solr.apache.org`. Requires `yq` to be installed. ```bash # First make sure that "yq" is installed kubectl get solrclouds.solr.bloomberg.com --all-namespaces -o yaml | \ sed "s#solr.bloomberg.com#solr.apache.org#g" | \ yq eval 'del(.items.[].metadata.annotations."kubectl.kubernetes.io/last-applied-configuration", .items.[].metadata.managedFields, .items.[].metadata.resourceVersion, .items.[].metadata.creationTimestamp, .items.[].metadata.generation, .items.[].metadata.selfLink, .items.[].metadata.uid, .items.[].spec.solrPodPolicy, .items.[].spec.zookeeperRef.provided.image.tag, .items.[].status)' - \ | kubectl apply -f - ``` ```bash kubectl get solrprometheusexporters.solr.bloomberg.com --all-namespaces -o yaml | \ sed "s#solr.bloomberg.com#solr.apache.org#g" | \ yq eval 'del(.items.[].metadata.annotations."kubectl.kubernetes.io/last-applied-configuration", .items.[].metadata.managedFields, .items.[].metadata.resourceVersion, .items.[].metadata.creationTimestamp, .items.[].metadata.generation, .items.[].metadata.selfLink, .items.[].metadata.uid, .items.[].spec.podPolicy, .items.[].status)' - \ | kubectl apply -f - ``` ```bash kubectl get solrbackups.solr.bloomberg.com --all-namespaces -o yaml | \ sed "s#solr.bloomberg.com#solr.apache.org#g" | \ yq eval 'del(.items.[].metadata.annotations."kubectl.kubernetes.io/last-applied-configuration", .items.[].metadata.managedFields, .items.[].metadata.resourceVersion, .items.[].metadata.creationTimestamp, .items.[].metadata.generation, .items.[].metadata.selfLink, .items.[].metadata.uid, .items.[].status)' - \ | kubectl apply -f - ``` -------------------------------- ### Install Solr Operator via Helm Source: https://github.com/apache/solr-operator/blob/main/docs/running-the-operator.md Installs the Solr Operator using the Helm chart. This command also installs the Zookeeper Operator by default. Ensure CRDs are applied beforehand if not using Helm 3's automatic CRD installation. ```bash kubectl create -f https://solr.apache.org/operator/downloads/crds/v0.10.0-prerelease/all-with-dependencies.yaml helm install solr-operator apache-solr/solr-operator --version 0.10.0-prerelease ``` -------------------------------- ### Run Default E2E Tests Source: https://github.com/apache/solr-operator/blob/main/dev-docs/e2e-testing.md Executes the E2E tests with default parameters, setting up a KinD cluster, installing the Solr Operator via Helm, and running tests in parallel across separate namespaces. The cluster is deleted upon successful completion. ```bash $ make e2e-tests ``` -------------------------------- ### Security Rules for Custom Probes Source: https://github.com/apache/solr-operator/blob/main/docs/solr-cloud/solr-cloud-crd.md Example JSON snippet showing security rules that would be added to `security.json` to allow access to custom liveness and readiness probe endpoints. ```json { "name": "k8s-probe-1", "role": null, "collection": null, "path": "/admin/customliveness" }, { "name": "k8s-probe-2", "role": null, "collection": null, "path": "/admin/customreadiness" } ``` -------------------------------- ### Install Zookeeper Operator with Helm Source: https://github.com/apache/solr-operator/blob/main/docs/development.md Installs the Zookeeper Operator using Helm. This is a dependency for the Solr Operator by default, but can be optionally excluded. ```bash helm repo add pravega https://charts.pravega.io helm install zookeeper-operator pravega/zookeeper-operator --version 0.2.15 ``` -------------------------------- ### Run Solr Operator Locally Source: https://github.com/apache/solr-operator/blob/main/docs/development.md Use this command to start the solr-operator process locally without deploying to Kubernetes. No Docker image build is required. ```bash make run ``` -------------------------------- ### Install Solr CRDs with Dependencies Source: https://github.com/apache/solr-operator/blob/main/docs/running-the-operator.md Installs all Solr CRDs along with the ZookeeperCluster CRD for a specific Solr Operator version. Use this command when you need all Solr-related custom resources and their dependencies. ```bash # Install all Solr CRDs as well as the dependency CRDS (ZookeeperCluster) for the given version of the Solr Operator kubectl create -f "https://solr.apache.org/operator/downloads/crds//all-with-dependencies.yaml" ``` -------------------------------- ### Install ZookeeperCluster CRD Only Source: https://github.com/apache/solr-operator/blob/main/docs/running-the-operator.md Installs only the ZookeeperCluster CRD required by the Solr Operator for a specific version. Use this when you only need the Zookeeper dependency and not all Solr CRDs. ```bash # Install just the ZookeeperCluster CRD used in the given version of the Solr Operator kubectl create -f "https://solr.apache.org/operator/downloads/crds//zookeeperclusters.yaml" ``` -------------------------------- ### Configure GCS Backup Repository in SolrCloud Spec Source: https://github.com/apache/solr-operator/blob/main/docs/solr-backup/README.md Example of a SolrCloud specification with a single GCS backup repository. Ensure the bucket and gcsCredentialSecret are correctly set. ```yaml spec: backupRepositories: - name: "gcs-backups-1" gcs: bucket: "backup-bucket" # Required gcsCredentialSecret: name: "secretName" key: "service-account-key.json" baseLocation: "/store/here" # Optional ``` -------------------------------- ### Run Solr Operator Release Wizard Source: https://github.com/apache/solr-operator/blob/main/docs/release-instructions.md Execute the release wizard script from the root of the repository on the branch intended for release. Ensure all prerequisites are installed and follow the on-screen prompts. ```bash ./hack/release/wizard/releaseWizard.py ``` -------------------------------- ### Install ZookeeperCluster CRD Source: https://github.com/apache/solr-operator/blob/main/helm/solr-operator/README.md Installs only the ZookeeperCluster CRD required for the Solr Operator. This is useful if you are managing other CRDs separately. Replace `` with the specific version you are using. ```bash # Install *just* the ZookeeperCluster CRD used in the given version of the Solr Operator kubectl create -f "https://solr.apache.org/operator/downloads/crds//zookeeperclusters.yaml" ``` -------------------------------- ### Check Cert-Manager Installation Source: https://github.com/apache/solr-operator/blob/main/docs/solr-cloud/solr-cloud-crd.md Use this command to verify if cert-manager CRDs are already present in your Kubernetes cluster. ```bash kubectl get crds -l app.kubernetes.io/instance=cert-manager ``` -------------------------------- ### Define Multiple Backup Repositories in SolrCloud Spec Source: https://github.com/apache/solr-operator/blob/main/docs/solr-backup/README.md Configure various backup repository types within the SolrCloud specification. This example shows how to define local, GCS, and S3 repositories. ```yaml spec: backupRepositories: - name: "local-collection-backups-1" volume: ... - name: "gcs-collection-backups-1" gcs: ... - name: "s3-collection-backups-1" s3: ... - name: "s3-collection-backups-2" s3: ... ``` -------------------------------- ### Deploy SolrCloud using Helm Chart Source: https://context7.com/apache/solr-operator/llms.txt Deploys a SolrCloud cluster using the official Solr Helm chart. Supports quick installs and detailed configuration options for production environments. ```bash # Quick install helm install example apache-solr/solr \ --version 0.10.0-prerelease \ --set image.tag=9.10.0 \ --set replicas=3 # Full example with options helm install production apache-solr/solr \ --version 0.10.0-prerelease \ --set image.tag=9.10.0 \ --set replicas=5 \ --set solrOptions.javaMemory="-Xms2g -Xmx4g" \ --set solrOptions.logLevel=WARN \ --set dataStorage.persistent.size=50Gi \ --set dataStorage.persistent.reclaimPolicy=Retain # Upgrade Solr version helm upgrade production apache-solr/solr \ --version 0.10.0-prerelease \ --reuse-values \ --set image.tag=9.10.0 # Uninstall helm uninstall example ``` -------------------------------- ### Configure SolrCloud Backup Repository Source: https://github.com/apache/solr-operator/blob/main/docs/solr-backup/README.md Add a backup repository definition to your SolrCloud instance to specify where backups should be stored. This example uses a previously created PersistentVolumeClaim. ```yaml spec: backupRepositories: - name: "local-collection-backups-1" volume: source: persistentVolumeClaim: claimName: "collection-backup-pvc" ``` -------------------------------- ### Copy Default solr.xml from Solr Pod Source: https://github.com/apache/solr-operator/blob/main/docs/solr-cloud/solr-cloud-crd.md Retrieve the default solr.xml configuration from a running Solr pod using kubectl cp. This is useful as a starting point for creating a custom solr.xml. ```bash SOLR_POD_ID=$(kubectl get pod -l technology=solr-cloud --no-headers -o custom-columns=":metadata.name" | head -1) kubectl cp $SOLR_POD_ID:/var/solr/data/solr.xml ./custom-solr.xml ``` -------------------------------- ### Retrieve Default Exporter Config Source: https://github.com/apache/solr-operator/blob/main/docs/solr-prometheus-exporter/README.md Use this command to copy the default Solr exporter configuration file from a running exporter pod. This is useful as a starting point for customization. ```bash EXPORTER_POD_ID=$(kubectl get pod -l solr-prometheus-exporter=dev-prom-exporter --no-headers -o custom-columns=":metadata.name") kubectl cp $EXPORTER_POD_ID:/opt/solr/contrib/prometheus-exporter/conf/solr-exporter-config.xml ./solr-exporter-config.xml ``` -------------------------------- ### Configure S3 Backup Repository in SolrCloud Spec Source: https://github.com/apache/solr-operator/blob/main/docs/solr-backup/README.md Example of a SolrCloud specification for an S3 backup repository. Required fields include region and bucket. Optional fields like credentials, proxyUrl, and endpoint can also be configured. ```yaml spec: backupRepositories: - name: "s3-backups-1" s3: region: "us-west-2" # Required bucket: "backup-bucket" # Required credentials: {} # Optional proxyUrl: "https://proxy-url-for-s3:3242" # Optional endpoint: "https://custom-s3-endpoint:3242" # Optional ``` -------------------------------- ### Verify Solr Operator Deployment Source: https://github.com/apache/solr-operator/blob/main/docs/running-the-operator.md Checks the status of running pods, deployments, and replica sets in the Kubernetes cluster to confirm that the Solr Operator and Zookeeper Operator have started correctly. ```bash kubectl get all ``` -------------------------------- ### Self-Signed Certificate Generation with cert-manager Source: https://github.com/apache/solr-operator/blob/main/docs/solr-cloud/solr-cloud-crd.md Example of generating a self-signed certificate using cert-manager, including a secret for the keystore password, an Issuer, and the Certificate CRD itself. Internal Kubernetes DNS names are not valid for public certificates. ```yaml --- ApiVersion: v1 kind: Secret metadata: name: pkcs12-password-secret data: password-key: SOME_PASSWORD_HERE --- ApiVersion: cert-manager.io/v1 kind: Issuer metadata: name: selfsigned-issuer spec: selfSigned: {} --- ApiVersion: cert-manager.io/v1 kind: Certificate metadata: name: selfsigned-cert spec: subject: organizations: ["dev"] dnsNames: - localhost - dev-dev-solrcloud.ing.local.domain - "*.ing.local.domain" secretName: dev-selfsigned-cert-tls issuerRef: name: selfsigned-issuer keystores: pkcs12: create: true passwordSecretRef: key: password-key name: pkcs12-password-secret ``` -------------------------------- ### Install Solr Operator Skipping CRDs Source: https://github.com/apache/solr-operator/blob/main/docs/running-the-operator.md Installs the Solr Operator chart into a specific namespace while skipping the CRD installation. This is useful when managing CRDs separately or in multi-namespace setups. ```bash helm install solr-operator apache-solr/solr-operator --skip-crds --namespace solr ``` -------------------------------- ### Configure Volume Backup Repository Source: https://github.com/apache/solr-operator/blob/main/docs/solr-backup/README.md Set up a local volume backup repository by specifying a PersistentVolumeClaim and an optional directory for storing backups. Ensure the volume has `accessMode: ReadWriteMany`. ```yaml spec: backupRepositories: - name: "local-collection-backups-1" volume: source: # Required persistentVolumeClaim: claimName: "collection-backup-pvc" directory: "store/here" # Optional ``` -------------------------------- ### Install Solr and Zookeeper CRDs Source: https://github.com/apache/solr-operator/blob/main/docs/local_tutorial.md Installs the Custom Resource Definitions (CRDs) for Solr and Zookeeper operators using kubectl. This is necessary before installing the Solr Operator chart. ```bash # Install the Solr & Zookeeper CRDs $ kubectl create -f https://solr.apache.org/operator/downloads/crds/v0.10.0-prerelease/all-with-dependencies.yaml ``` -------------------------------- ### Provide Custom solr.xml via ConfigMap Source: https://github.com/apache/solr-operator/blob/main/docs/solr-cloud/solr-cloud-crd.md Create a ConfigMap to provide a custom solr.xml file. Ensure the ConfigMap uses 'solr.xml' as the key and includes the essential '${solr.port.advertise:0}' element for operator functionality. ```yaml --- kind: ConfigMap apiVersion: v1 metadata: name: custom-solr-xml data: solr.xml: | ... CUSTOM CONFIG HERE ... ``` -------------------------------- ### Prepare for Commit Source: https://github.com/apache/solr-operator/blob/main/docs/development.md Run this command before committing to ensure that linting checks will pass. This is automatically checked by GitHub actions. ```bash make prepare ``` -------------------------------- ### Clean Solr Operator Dependencies Source: https://github.com/apache/solr-operator/blob/main/docs/development.md Cleans previously installed dependencies for the Solr Operator. Use this if you have older versions installed. ```bash make clean ``` -------------------------------- ### Apply Service Monitor to Monitoring Namespace Source: https://github.com/apache/solr-operator/blob/main/docs/solr-prometheus-exporter/README.md Apply the created ServiceMonitor YAML file to the Kubernetes cluster. This command assumes the ServiceMonitor is saved as 'dev-prom-service-monitor.yaml' and should be applied to the 'monitoring' namespace. ```bash kubectl apply -f dev-prom-service-monitor.yaml -n monitoring ``` -------------------------------- ### Configure SolrCloud Scaling Options Source: https://github.com/apache/solr-operator/blob/main/docs/solr-cloud/scaling.md Set `vacatePodsOnScaleDown` and `populatePodsOnScaleUp` to manage replica movement during scaling. `vacatePodsOnScaleDown` defaults to true, ensuring replicas are moved off pods before deletion. `populatePodsOnScaleUp` also defaults to true, facilitating replica distribution on new pods. ```yaml spec: scaling: vacatePodsOnScaleDown: true # Default: true populatePodsOnScaleUp: true # Default: true ``` -------------------------------- ### Configure PKCS12 Keystore Creation Source: https://github.com/apache/solr-operator/blob/main/docs/solr-cloud/solr-cloud-crd.md Configure your certificate instance to request a PKCS12 keystore. This allows the Solr operator to mount the keystore directly on Solr pods. A password is required for PKCS12 keystores. ```yaml spec: keystores: pkcs12: create: true passwordSecretRef: key: password-key name: pkcs12-password-secret ``` -------------------------------- ### Build Solr Operator Go Binary Source: https://github.com/apache/solr-operator/blob/main/docs/development.md Builds the Go binary for the Solr Operator. This is useful for local testing and can be used with the `make run` command. ```bash make build ``` -------------------------------- ### Configure Solr Pod Liveness/Readiness Probes Source: https://github.com/apache/solr-operator/blob/main/docs/solr-cloud/solr-cloud-crd.md Increase probe timeouts when using mTLS with a separate client certificate to prevent premature restarts. ```yaml spec: ... customSolrKubeOptions: podOptions: livenessProbe: timeoutSeconds: 10 readinessProbe: timeoutSeconds: 10 ``` -------------------------------- ### Install Solr Operator CRDs v0.3.0 Source: https://github.com/apache/solr-operator/blob/main/docs/upgrading-to-apache.md Installs the Custom Resource Definitions (CRDs) for Solr Operator version 0.3.0. Use the `all-with-dependencies.yaml` if you are using the ZK Operator. ```bash kubectl create -f "https://solr.apache.org/operator/downloads/crds/v0.3.0/all.yaml" ``` ```bash kubectl create -f "https://solr.apache.org/operator/downloads/crds/v0.3.0/all-with-dependencies.yaml" || \ kubectl replace -f "https://solr.apache.org/operator/downloads/crds/v0.3.0/all-with-dependencies.yaml" ``` -------------------------------- ### Run Unit Tests Source: https://github.com/apache/solr-operator/blob/main/docs/development.md Execute all unit tests locally to ensure code quality and functionality before creating a pull request. Tests are located in the controllers directory. ```bash make test ``` -------------------------------- ### Custom Solr Liveness and Readiness Probes Source: https://github.com/apache/solr-operator/blob/main/docs/solr-cloud/solr-cloud-crd.md Configure custom HTTP paths for liveness and readiness probes under `spec.customSolrKubeOptions.podOptions`. Note that `probesRequireAuth` must be set to `false` if using custom HTTP probes. ```yaml spec: ... customSolrKubeOptions: podOptions: livenessProbe: httpGet: scheme: HTTP path: /solr/admin/customliveness port: 8983 readinessProbe: httpGet: scheme: HTTP path: /solr/admin/customreadiness port: 8983 ``` -------------------------------- ### Get SolrCloud Status Source: https://github.com/apache/solr-operator/blob/main/docs/solr-cloud/README.md Retrieves the status of SolrCloud resources in your Kubernetes cluster. ```bash kubectl get solrclouds ``` -------------------------------- ### Delete SolrCloud Cluster Source: https://github.com/apache/solr-operator/blob/main/docs/solr-cloud/README.md Deletes a SolrCloud resource named 'example' from your Kubernetes cluster. ```bash kubectl delete solrcloud example ``` -------------------------------- ### Verify Solr Operator Pods Source: https://context7.com/apache/solr-operator/llms.txt Check the status of the Solr Operator pods after an upgrade or installation. ```bash kubectl get pods -l app.kubernetes.io/name=solr-operator ``` -------------------------------- ### Build and Push Solr Operator Docker Image Source: https://github.com/apache/solr-operator/blob/main/docs/development.md Builds and pushes a test Solr Operator Docker image to a specified repository. The REPOSITORY, NAME, and TAG environment variables can be used to customize the image details. ```bash REPOSITORY=your-repository make docker-build docker-push ``` -------------------------------- ### Check Operator Status Source: https://github.com/apache/solr-operator/blob/main/docs/local_tutorial.md Verifies that the Solr and Zookeeper operators have started correctly by listing cluster resources. ```bash $ kubectl get all ``` -------------------------------- ### Apply ServiceMonitor Configuration Source: https://context7.com/apache/solr-operator/llms.txt Apply the ServiceMonitor YAML file to the monitoring namespace to integrate the Solr exporter with Prometheus. ```bash # Apply in monitoring namespace kubectl apply -f servicemonitor.yaml -n monitoring ``` -------------------------------- ### Install Solr CRDs to Kubernetes Source: https://github.com/apache/solr-operator/blob/main/docs/development.md Applies the generated Solr Custom Resource Definitions (CRDs) to your Kubernetes cluster. ```bash make install ``` -------------------------------- ### Get Kubernetes Dashboard Token Source: https://github.com/apache/solr-operator/blob/main/docs/local_tutorial.md Obtain a token to authenticate with the Kubernetes Dashboard. This token is required to log in to the dashboard UI. ```bash # You need to authenticate with the dashboard. Get a token: kubectl -n kubernetes-dashboard describe secret \ $(kubectl -n kubernetes-dashboard get secret | grep default-token | awk '{print $1}') \ | grep "token:" | awk '{print $2}' ``` -------------------------------- ### Replace Solr CRDs Source: https://github.com/apache/solr-operator/blob/main/docs/upgrade-notes.md Use this command to update only the Solr CRDs. Replace `` with the specific Solr Operator version you are installing. ```bash # Just replace the Solr CRDs kubectl replace -f "http://solr.apache.org/operator/downloads/crds//all.yaml" ``` -------------------------------- ### Manage SolrBackups with kubectl Source: https://context7.com/apache/solr-operator/llms.txt Use kubectl commands to check the status, inspect details, delete SolrBackup resources, and verify backup files on the volume. ```bash # Check backup status kubectl get solrbackups # NAME CLOUD STARTED FINISHED SUCCESSFUL NEXTBACKUP AGE # daily-backup example 15m true true 2024-06-02T00:00:00Z 1d # Inspect per-collection details kubectl describe solrbackup daily-backup # Delete the SolrBackup object (does NOT delete stored backup data) kubectl delete solrbackup manual-backup # Verify backed-up files on volume kubectl exec example-solrcloud-0 -- ls -lh \ /var/solr/data/backup-restore/local-backups/backups/ ``` -------------------------------- ### Upgrade Solr Operator with Helm Source: https://context7.com/apache/solr-operator/llms.txt Use this command to upgrade an existing Solr Operator installation to a new version. Ensure CRDs are updated first. ```bash kubectl replace -f https://solr.apache.org/operator/downloads/crds/v0.10.0-prerelease/all-with-dependencies.yaml helm upgrade solr-operator apache-solr/solr-operator \ --version 0.10.0-prerelease \ --reuse-values ``` -------------------------------- ### Interact with Solr Prometheus Exporter Source: https://context7.com/apache/solr-operator/llms.txt Use kubectl commands to check exporter logs and port-forward to query metrics. Ensure the exporter is running and accessible. ```bash # Check exporter logs kubectl logs -l solr-prometheus-exporter=dev-prom-exporter # Port-forward and query metrics kubectl port-forward \ $(kubectl get pod -l solr-prometheus-exporter=dev-prom-exporter \ --no-headers -o custom-columns=":metadata.name") 8080 curl http://localhost:8080/metrics | grep solr_ ```