3

We are doing a Kubernetes install and the part of the SOLR SearchStax install the process is not completing. We get some Successful Creates, but also see an error that BackOffLimitExceeded. The job status stays at 0/1 completed and we notice the SOLR Cores are not created. Has anyone run into this issue? Is there a setting or kubectl command we need to run? We added the IP to the SearchStax deployment IP filter, but we are still running into the issue.

enter image description here

Here is the error we see in the log:

Invoke-RestMethod :
 Error 401 Authentication failed, Response code: 401
 HTTP ERROR 401
 Problem accessing /solr/admin/collections. Reason:
 Authentication failed, Response code: 401
At C:\Start.ps1:58 char:21
 + ... lections = (Invoke-RestMethod -Uri "$SolrEndpoint/admin/collections?a ...
 + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:Htt
 pWebRequest) [Invoke-RestMethod], WebException
 + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShe
 ll.Commands.InvokeRestMethodCommand
enter code here

3 Answers 3

2

The solr-init data initialization container script is failing while performing a request to get the list of collections from the Solr service:

$solrCollections = (Invoke-RestMethod -Uri "$SolrEndpoint/admin/collections?action=LIST&omitHeader=true" -Method Get -Credential (Get-SolrCredential)).collections

You are getting a 401 HTTP status code, not a 404, so it seems that your Solr service is reachable, but it is failing on the authentication process.

The Get-SolrCredential function, used to build the value for the -Credential parameter in the failing GET request, returns a $null object with the default K8s configuration, because the SOLR_USERNAME and SOLR_PASSWORD environment variables are not defined as secrets in the solr-init.yaml deployment configuration and there are no secrets files for them in the secrets folder:

function Get-SolrCredential {
    if ($env:SOLR_USERNAME -and $env:SOLR_PASSWORD) {
        return New-Object Management.Automation.PSCredential ($env:SOLR_USERNAME, (ConvertTo-SecureString $env:SOLR_PASSWORD -AsPlainText -Force))
    }
    return $null
}

If your Solr service requires authentication credentials to access it, you need to create them in the secrets folder and define these two missing secrets in your solr-init.yaml K8s deployment configuration.

3
  • We just tried this. Unfortunately it did not work.
    – RReilley
    Commented Jun 8, 2021 at 1:16
  • Any special character in the password? This page might help on solving the 401 authentication error too: searchstax.com/docs/hc/unauthorized-error Commented Jun 8, 2021 at 1:36
  • Ended up removing the username and password and used API keys instead. Now it is working. Thanks.
    – RReilley
    Commented Jun 8, 2021 at 20:39
1

What we ended up doing is removing the username and password and just using the API keys. It worked after that.

2
  • API Keys are used by the solr-init job only to deploy a new Solr core config. Disabling the Basic Authentication of your Solr instance is a workaround, but be sure to re-enable it again once the data initialization job runs successfully, if this is a production instance (see also searchstax.com/docs/security/#solrauth). Commented Jun 8, 2021 at 20:49
  • Thanks @AlessandroFaniuolo.
    – RReilley
    Commented Jun 9, 2021 at 19:24
1

This is probably happening because you have enabled basic authentication in SOLR. But the fix is easy, all you need to do is add the username and password in your SOLR connection strings.

The connection string in the K8s secret files needs to look like this:

https://USERNAME:[email protected]/solr;solrCloud=true

It is always a good idea to have authentication specially in prod environments, so before disabling the auth, try using that method. I tested it and it is working in Sitecore 10.1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.