jx edit env command fails with error: creating Jenkins client: secrets "jenkins" not found
jx bootjx edit env stagingPromotion Strategy: ManualThe promotion strategy for the staging environment was changed to Manual.
? Label: Staging
? Namespace: jx-********-staging
? Domain: ********.com
? Environment in separate cluster to Dev Environment: No
? Promotion Strategy: Manual
? Git URL for the Environment source code: https://github.com/********/environment-********-staging.git
? Git branch for the Environment source code: master
Updated environment staging
? Do you wish to use ******** as the user name to create the Git repository Yes
error: creating Jenkins client: secrets "jenkins" not found
The output of jx version is:
NAME VERSION
jx 2.0.1192
Kubernetes cluster v1.15.6
kubectl v1.17.2
helm client Client: v2.16.1+gbbdfe5e
git 2.25.0
Operating System Mac OS X 10.15.3 build 19D76
verifying packages
jx-requirements.yml version stream:
versionStream:
ref: v1.0.347
url: https://github.com/jenkins-x/jenkins-x-versions.git
Self-created with kubespray
Running the CLI on my MacBook Pro (OS X)
Hi - looks like you're not in the jx namespace. Could you make sure you're using the jx namespace and try again?
@abayer yes, I checked it twice for dev and staging namespaces
alex@Alex-MacBook-Pro razomer-dev % jx namespace
? Change namespace: jx-razomer
Using namespace 'jx-razomer' from context named 'alex@geeoz-km01' on server 'https://116.202.16.6:6443'.
alex@Alex-MacBook-Pro razomer-dev % jx edit env staging
? Label: Staging
? Namespace: jx-razomer-staging
? Domain: razomer.com
? Environment in separate cluster to Dev Environment: No
? Promotion Strategy: Manual
? Git URL for the Environment source code: https://github.com/geeoz/environment-razomer-staging.git
? Git branch for the Environment source code: master
Updated environment staging
? Do you wish to use alexvolsh as the user name to create the Git repository Yes
error: creating Jenkins client: secrets "jenkins" not found
alex@Alex-MacBook-Pro razomer-dev % jx namespace
? Change namespace: jx-razomer-staging
Now using namespace 'jx-razomer-staging' on server 'https://116.202.16.6:6443'.
alex@Alex-MacBook-Pro razomer-dev %
alex@Alex-MacBook-Pro razomer-dev % jx edit env staging
? Label: Staging
? Namespace: jx-razomer-staging
? Domain: razomer.com
? Environment in separate cluster to Dev Environment: No
? Promotion Strategy: Manual
? Git URL for the Environment source code: https://github.com/geeoz/environment-razomer-staging.git
? Git branch for the Environment source code: master
Updated environment staging
? Do you wish to use alexvolsh as the user name to create the Git repository Yes
error: creating Jenkins client: secrets "jenkins" not found
Do you see the jenkins secret if you run kubectl get secrets in the jx-razomer namespace? I feel like this is likely to either be that the secret isn't there, or something in the code path being executed is hardcoding a namespace.
No, it doesn鈥檛 exist. And also I鈥檝e checked previous installations for Serverless Jenkins X by jx install and there is no jenkins secret in any of them.
Last login: Thu Feb 13 17:03:53 2020 from 10.20.100.1
Alex-Mac-mini:~ alex$ kubens jx-razomer
Context "alex@km01" modified.
Active namespace is "jx-razomer".
Alex-Mac-mini:~ alex$ kubectl get secrets | grep jenkins
jenkins-docker-cfg Opaque 1 4h12m
jenkins-maven-settings Opaque 1 4h12m
jenkins-npm-token Opaque 1 4h12m
jenkins-release-gpg Opaque 4 4h12m
jenkins-ssh-config Opaque 1 4h12m
jenkins-x-chartmuseum Opaque 2 4h12m
jenkins-x-controllerrole-token-kw7qw kubernetes.io/service-account-token 3 4h12m
jenkins-x-docker-registry-secret Opaque 1 4h12m
jenkins-x-gcactivities-token-qdz4r kubernetes.io/service-account-token 3 4h12m
jenkins-x-gcpods-token-cqfv5 kubernetes.io/service-account-token 3 4h12m
jenkins-x-gcpreviews-token-m85qr kubernetes.io/service-account-token 3 4h12m
jenkins-x-heapster-token-np8vb kubernetes.io/service-account-token 3 4h12m
No, it doesn鈥檛 exist. And also I鈥檝e checked previous installations for Serverless Jenkins X by
jx installand there is nojenkinssecret in any of them.Last login: Thu Feb 13 17:03:53 2020 from 10.20.100.1 Alex-Mac-mini:~ alex$ kubens jx-razomer Context "alex@km01" modified. Active namespace is "jx-razomer". Alex-Mac-mini:~ alex$ kubectl get secrets | grep jenkins jenkins-docker-cfg Opaque 1 4h12m jenkins-maven-settings Opaque 1 4h12m jenkins-npm-token Opaque 1 4h12m jenkins-release-gpg Opaque 4 4h12m jenkins-ssh-config Opaque 1 4h12m jenkins-x-chartmuseum Opaque 2 4h12m jenkins-x-controllerrole-token-kw7qw kubernetes.io/service-account-token 3 4h12m jenkins-x-docker-registry-secret Opaque 1 4h12m jenkins-x-gcactivities-token-qdz4r kubernetes.io/service-account-token 3 4h12m jenkins-x-gcpods-token-cqfv5 kubernetes.io/service-account-token 3 4h12m jenkins-x-gcpreviews-token-m85qr kubernetes.io/service-account-token 3 4h12m jenkins-x-heapster-token-np8vb kubernetes.io/service-account-token 3 4h12m
I'm experiencing the exact same issue. I'm probably created/destroyed about 20 jx GKE clusters (via the jx cli) over the past few weeks and have never seen a jenkins secret in the jx namespace.
Environment setup below.
$ jx version
NAME VERSION
jx 2.0.1188
Kubernetes cluster v1.14.9-gke.23
kubectl v1.16.0
helm client Client: v2.14.3+g0e7f3b6
git 2.21.0
Operating System Mac OS X 10.12.6 build 16G2136
@abayer Would you happen to know whether there is any way to properly create a jenkins secret from scratch if its missing? Alternatively, if you have an example yaml manifest for the secret available, and the secret info itself is simply the standard jx base64 encoded creds, then those of us with running jx environments could at least add a hotfix to our provisioning scripts.
I think you can use this YAML to manually create the secret:
apiVersion: v1
data:
jenkins-admin-password: dGVzdFBhc3N3b3JkQWRtaW4=
jenkins-admin-user: YWRtaW4=
kind: Secret
type: Opaque
The command to manually create it:
kubectl create secret generic jenkins -n jx --from-literal=jenkins-admin-user=admin --from-literal=jenkins-admin-password=testAdminPassword
I can confirm this is still happening on the latest jx version on GKE:
NAME VERSION
jx 2.1.31
Kubernetes cluster v1.14.10-gke.27
kubectl v1.14.10-dispatcher
helm client 2.16.7
git 2.20.1
Operating System Ubuntu 19.10
verifying packages
DEBUG: Current configuration dir: /home/gab/.jxDEBUG: VersionRepository: https://github.com/jenkins-x/jenkins-x-versions.git git ref: v1.0.452
@hervelemeur didn't work for me, it stops later saying
error: creating Jenkins client: unable to find external URL of service jenkins in namespace jx
Seem it is still using the old classic code while i'm on jenkins boot.
jx edit environment is unusable. (another mine in the 700 bug minefield of jx...)
Will meed to investigate jx edit environment. Seems to be a legit issue.
Just took a quick look, and it appears jx edit env and jx create env are still calling a legacy ImportProject function that tries to import a Jenkins multi-branch project. I...have no idea why that's the case.
We are observing the same error during the execution of jx edit env:
-> jx version
NAME VERSION
jx 2.1.55
Kubernetes cluster v1.18.3
kubectl v1.13.2
helm client 2.12.2
git 2.24.1 (Apple Git-126)
Operating System Mac OS X 10.15.5 build 19F96
/assign ankitm123
Related to #7232
@hervelemeur if we add the secret(jenkins) manually, we will face error: creating Jenkins client: unable to find external URL of service jenkins in namespace jx
Any body got solution for the above error (@alexvolsh )?
Hi, I got same.
Anybody has solution for this?
Same issue for me. First, the secret issue then unable to find external URL of service jenkins in namespace jx
I have exactly the same issue like the one reported above.
I've solved it following this gist:
GKE: https://gist.github.com/vfarcic/fe18870a015f4acc34d91c106d0d43c8
EKS: https://gist.github.com/vfarcic/f4a1df244d1852ee250e751c7191f5bd
AKS: https://gist.github.com/vfarcic/b07f45f6907c2a1c71f45dbe0df8d410
Serverless: https://gist.github.com/vfarcic/7b3b3d90ecd7f343effe4fff5241d037
It is from a great book: The DevOps toolkit series: The Devops 2-6 toolkit - Jenkins X Cloud-Native Kubernetes-First Continous Delivery
Most helpful comment
Same issue for me. First, the secret issue then
unable to find external URL of service jenkins in namespace jx