Answers: <p>It is possible to create a secret without passing on the commandline by reading it from file:</p>
  
  <blockquote>
  <pre><code>$ kubectl create secret generic ssh-key-secret \
    --from-file=ssh-privatekey=/path/to/.ssh/id_rsa \
    --from-file=ssh-publickey=/path/to/.ssh/id_rsa.pub
  </code></pre>
  </blockquote>
  
  <p>See <a href="https://kubernetes.io/docs/concepts/configuration/secret/" rel="nofollow noreferrer">https://kubernetes.io/docs/concepts/configuration/secret/</a> for more information.</p>
  
Answers: CC BY-SA 3.0
Answers: 2018-04-27T16:36:16.017Z
Answers: 2018-04-27T16:36:16.017Z
Answers: 030
Body: <p>According to this document</p>
  
  <p><a href="https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/" rel="nofollow noreferrer">https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/</a></p>
  
  <p>one could create a docker registry by running:</p>
  
  <pre><code>kubectl create secret docker-registry regcred \
  --docker-server=&lt;your-registry-server&gt; \
  --docker-username=&lt;your-name&gt; \
  --docker-password=&lt;your-pword&gt; --docker-email=&lt;your-email&gt;
  </code></pre>
  
  <p>How to create a secret without entering the password as plain text?</p>
  
Tags: <kubernetes>
Title: How to create a docker registry secret without passing the password on the command line?
UserDisplayName: 030
ThreadText: # How to create a docker registry secret without passing the password on the command line?
  
  (Asked by: username_0 on 2018-03-11)
  
  According to this document
  
  <https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/>
  
  one could create a docker registry by running:
  
  ```
  kubectl create secret docker-registry regcred \
  --docker-server=<your-registry-server> \
  --docker-username=<your-name> \
  --docker-password=<your-pword> --docker-email=<your-email>
  
  ```
  
  How to create a secret without entering the password as plain text?
  
  **Tags:** kubernetes
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-04-27. Score: 0 | Accepted answer
  
  It is possible to create a secret without passing on the commandline by reading it from file:
  
  > ```
  > $ kubectl create secret generic ssh-key-secret \
  >   --from-file=ssh-privatekey=/path/to/.ssh/id_rsa \
  >   --from-file=ssh-publickey=/path/to/.ssh/id_rsa.pub
  >
  > ```
  
  See <https://kubernetes.io/docs/concepts/configuration/secret/> for more information.
  
  
  ---
  
  