-
Bug
-
Resolution: Unresolved
-
Blocker
-
Kubernetes
I have the following secret in Kubernetes cluster:
```
apiVersion: v1
kind: Secret
metadata:
name: mysecret
namespace: <namespace>
labels:
credential.sync.jenkins.openshift.io: 'true'
type: Opaque
data:
username: <username>
password: <password>
```
I have tried to restart the jenkins pod in my k8s cluster. However, the secret does not show up in the jenkins /credentials/ page.
According to https://jenkinsci.github.io/kubernetes-credentials-provider-plugin/ I have also tried the following secret label:
```
apiVersion: v1
kind: Secret
metadata:
name: mysecret
namespace: <namespace>
labels:
"jenkins.io/credentials-type": "usernamePassword"
type: Opaque
data:
username: <username>
password: <password>
```
And accessing it in my jenkins pipeline Jenkinsfile using the following snippet:
```
withCredentials([usernamePassword(credentialsId: 'nexus', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { withCredentials([usernamePassword(credentialsId: 'mysecret', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')])
{ echo PASSWORD echo USERNAME }```
result in the following error:
`ERROR: Could not find credentials entry with ID 'mysecret'`
khteh Using the latest version of the plugin, it seems to work correctly for me. Assuming that your secret was successfully inserted into the cluster, does the plugin report anything in the system logs?