Elasticsearch on Kubernetes not able to authenticate to azure container registry

I have created custom docker image of Elasticsearch which contains some plugins. Then published this docker image to azure container registry. Then I configured Elasticsearch spec as below

apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: liferay-elasticsearch
spec:
  image: liferay.azurecr.io/liferay/elasticsearch:7.16.0.customLiferayPlugin
  secureSettings:
  - secretName: acrlogin

Then I have executed this yaml file, but pod is not running, its showing error that failed to authorize: failed to fetch anonymous token: unexpected status: 401 Unauthorized

It seems the secret is not attaching with the pod definition.

The same credentials works for other docker images to pull.

Kindly advise.

Thanks

I found the solution, the code should be like this:

apiVersion: elasticsearch.k8s.elastic.co/v1
kind: Elasticsearch
metadata:
  name: liferay-elasticsearch
spec:
  image: liferay.azurecr.io/liferay/elasticsearch:7.16.0.customLiferayPlugin
  version: 7.16.0
  nodeSets:
  - name: default
    count: 1
    podTemplate:
      spec:
        imagePullSecrets:
        - name: acrlogin

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.