<p>Hi I have added secret in my hashi corp vault in the below path</p>
<p>cep-kv/dev/sqlpassword</p>
<p>I am trying to access secret in my manifest as below</p>
<pre><code>spec:
      serviceAccountName: default
      containers: # List
        - name: cep-container
          image: myinage:latest
          env:
          - name: AppSettings__Key
            value: vault:cep-kv/dev/sqlpassword#sqlpassword
</code></pre>
<p>This is throwing error below</p>
<pre><code>failed to inject secrets from vault: failed to read secret from path: cep-kv/dev/sqlpassword: Error making API request.\n\nURL: GET https://vaultnet/v1/cep-kv/dev/sqlpassword?version=-1\nCode: 403. Errors:\n\n* 1 error occurred:\n\t* permission denied\n\n&quot; app=vault-env
</code></pre>
<p>Is the path I am trying to access is correct value:</p>
<blockquote>
<p>vault:cep-kv/dev/sqlpassword#sqlpassword</p>
</blockquote>
<p>I tried with below path too</p>
<pre><code>value: vault:cep-kv/dev/sqlpassword
</code></pre>
<p>This says secret not found in respective path. Can someone help me to get secret from hashi corp vault. Any help would be appreciated. Thanks</p>

Niranjan godbole
<p>As you are getting 403 permission you need to Configure Kubernetes authentication, you can configure authentication from the following step:</p>
<ol>
<li>Enable the Kubernetes auth method:</li>
</ol>
<blockquote>
<p><code>vault enable auth kubernetes</code></p>
</blockquote>
<ol start="2">
<li>Configure the Kubernetes authentication method to use the location of the Kubernetes API</li>
</ol>
<pre><code>vault write auth/kubernetes/config \
  kubernetes_host=https://192.168.99.100:&lt;your TCP port or blank for 443&gt;
</code></pre>
<ol start="3">
<li><p>Create a named role:</p>
<pre><code>vault write auth/kubernetes/role/demo \
             bound_service_account_names=myapp \
                 bound_service_account_namespaces=default \
                 policies=default \
             ttl=1h
</code></pre>
</li>
<li><p>Write out the ” myapp ” policy that enables the “read” capability for secrets at the path .</p>
<pre><code>vault policy write myapp -path &quot;yourpath&quot;                                                  
{  capabilities = [&quot;read&quot;] } 
</code></pre>
</li>
</ol>
<p>For more information follow <a href="https://developer.hashicorp.com/vault/docs/auth/kubernetes#configuration" rel="nofollow noreferrer">Configuration</a>, Here is a <a href="https://blog.cloudthat.com/detailed-guide-to-securely-manage-secrets-for-kubernetes-using-hashicorp-vault/" rel="nofollow noreferrer">blog</a> explaining the usage of secrets in kubernetes.</p>
