When cloning/fetching a Git repository in a Jenkins pipeline, the Git Client plugin uses the configured *Host Key Verification Strategy* to verify the SSH host key of the remote Git server. Unfortunately, there does not seem to be any way to use the configured strategy from the `git` command line in a Pipeline job, so e.g. `git push` does not respect it. This causes jobs to fail to push changes to the remote if the container they're using does not already have the SSH host key for the remote in its known hosts database. This commit adds a ConfigMap to the *jenkins-jobs* namespace that can be mounted in containers to populate the SSH host key database. |
||
---|---|---|
.. | ||
README.md | ||
jenkins.yaml | ||
kustomization.yaml | ||
ssh_known_hosts |
README.md
Jenkins in Kubernetes
Kubernetes Setup
Configure Jenkins resources:
ln imagepull-gitea jenkins/.dockerconfigjson
kubectl apply -k jenkins
Jenkins Setup
Install Kubernetes plugin.
Set TCP port for inbound agents setting (Manage Jenkins → Configure Global
Security) to Fixed and enter 40414
.
Configure Kubernetes (Manage Jenkins → Manage Nodes and Clouds → Configure Clouds:
- Add a new cloud → Kubernetes
- Enter a name
- Kubernetes Cloud details...
- Kubernetes URL: (leave blank; will use Kubernetes service discovery)
- Kubernetes Namespace:
jenkins-jobs
- Credentials:
- none -
(will use Service Account token) - Jenkins tunnel:
jenkins.jenkins.svc.cluster.local:
(trailing colon!)