# Unable to add keystore secure password through kubernetes init containers

**URL:** <https://discuss.elastic.co/t/unable-to-add-keystore-secure-password-through-kubernetes-init-containers/231216>\
**Category:** Elasticsearch\
**Tags:** docker\
**Created:** [May 5, 2020, 7:57pm UTC](https://discuss.elastic.co/t/unable-to-add-keystore-secure-password-through-kubernetes-init-containers/231216 "2020-05-05T19:57:08Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![avinashashukla](https://avatars.discourse-cdn.com/v4/letter/a/90db22/32.png) [@avinashashukla](https://discuss.elastic.co/u/avinashashukla)\
**Post date:** [May 5, 2020, 7:57pm UTC](https://discuss.elastic.co/t/unable-to-add-keystore-secure-password-through-kubernetes-init-containers/231216/1 "2020-05-05T19:57:08Z")

</div>

1. Deploying elasticsearch as docker in kubernetes
2. Trying to add keystore secure password as part of kubernetes init container while deploying the a statefulset but the password is not getting added.

```auto
      initContainers:
      - name: setup
        image: $REGISTRY_ADDRESS/elasticsearch:$DOCKER_TAG
        env:
        - name: XPACK_SECURITY_TRANSPORT_SSL_KEYSTORE_SECURE_PASSWORD
          valueFrom:
            secretKeyRef:
              name: $K8S_SERVICE_SECRETS
              key: xpack.security.transport.ssl.keystore.secure_password
        command:
        - sh
        - -c
        - |
          echo $XPACK_SECURITY_TRANSPORT_SSL_KEYSTORE_SECURE_PASSWORD | /usr/share/elasticsearch/bin/elasticsearch-keystore add --stdin --force xpack.security.transport.ssl.keystore.secure_password
        resources:
          requests:
            cpu: $POD_RESOURCE_REQUESTS_CPU
            memory: $POD_RESOURCE_REQUESTS_MEM
          limits:
            cpu: $POD_RESOURCE_LIMITS_CPU
            memory: $POD_RESOURCE_LIMITS_MEM
        securityContext:
          privileged: true

```

1. Tried adding as docker args but it fails for below reason.

```auto
docker run es-local echo abc | /usr/local/share/elasticsearch/bin/elasticsearch-keystore add abc
-bash: /usr/local/share/elasticsearch/bin/elasticsearch-keystore: No such file or directory
write /dev/stdout: broken pipe

```

---

<div class="post-metadata">

**Author:** ![William\_Brafford](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/william_brafford/32/51559_2.png) [@William\_Brafford](https://discuss.elastic.co/u/William_Brafford)\
**Post date:** [May 11, 2020, 7:00pm UTC](https://discuss.elastic.co/t/unable-to-add-keystore-secure-password-through-kubernetes-init-containers/231216/2 "2020-05-11T19:00:14Z")

</div>

Hello,

I have some experience with Docker and the Elasticsearch keystore utilities, but unfortunately I have less experience with Kubernetes. I see you've posted a fragment of your configuration file. Do you think you could create a version of the configuration where I could run `kubectl -f sample-conf.yaml` and see the problem for myself?

-William

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 8, 2020, 7:05pm UTC](https://discuss.elastic.co/t/unable-to-add-keystore-secure-password-through-kubernetes-init-containers/231216/3 "2020-06-08T19:05:34Z")

</div>

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