<p>I have a service with an inline plaintext config that requires certain information that is stored in Kubernetes secrets. What <a href="https://pulumi.io/reference/pkg/nodejs/@pulumi/kubernetes/" rel="nofollow noreferrer"><code>@pulumi/kubernetes</code></a> API method can be used to access raw kubernetes secret values?</p>

<p>Use <code>k8s.core.v1.Secret.get(pulumiName, secretName)</code> (<a href="https://www.pulumi.com/docs/reference/pkg/nodejs/pulumi/kubernetes/core/v1/#Secret-get" rel="noreferrer"><code>secretName</code> can contain the <code>namespace/</code> as prefix</a>). </p>

<p><a href="https://www.pulumi.com/blog/adopting-existing-cloud-resources-into-pulumi/#referencing-existing-resources" rel="noreferrer">Every Pulumi resource has a <code>get()</code> method</a>.</p>

<p>For example: Get the <code>token</code> from a <code>kubernetes.io/service-account-token</code>:</p>

<pre class="lang-js prettyprint-override"><code>import * as k8s from "@pulumi/kubernetes";
​
type KubernetesSecretData = { [key: string]: string }
​
const namespace = 'kube-public'
const secretName = 'default-token-tdcdz'
​
export const token =
    k8s.core.v1.Secret.get('testSecret',`${namespace}/${secretName}`)
        .data.apply(v =&gt; {
        return (&lt;KubernetesSecretData&gt; v)["token"]
    })
</code></pre>
