Hey guys, I am trying to lookup a kubernetes secre...
# kubernetes
f
Hey guys, I am trying to lookup a kubernetes secret which holds the sa token and extract it. For some reason (in python) when I to a Secret.get and try to extract the token I just get a NoneType error. Its almost like it isn’t retrieving the data but if I switch the id to something that doesn’t exist it does give me an error saying it can’t find it so I know it is finding the secret. Just wanted to make sure I wasn’t doing something obviously wrong.
Copy code
sa_secret = pulumi_kubernetes.core.v1.Secret.get(
    resource_name="vault-auth",
    id="kube-system/vault-auth-token-fsl4p",
    opts=ResourceOptions(
        provider=kubernetes_provider
    )
)
token = sa_secret.data.apply(lambda x: x['token'])
AttributeError: ‘NoneType’ object has no attribute ‘apply’
g
Does it work if you change the last line to this?
Copy code
token = sa_secret['data'].apply(lambda x: x['token'])
f
Running that I get a different error
Copy code
token = sa_secret['data'].apply(lambda x: x['token'])
    TypeError: 'Secret' object is not subscriptable