- kubectl create namespace jenkins
- kubectl create -f jenkins.yaml --namespace jenkins
- kubectl create -f jenkins-service.yaml --namespace jenkins
- kubectl get nodes -o wide
The output will have various nodes with external IPs.Copy one of the external_ip values (for minikube, copy the internal_ip) an access the UI at
Page will appear asking for administrator password and instructions on retrieving the password from the pod logs.
- kubectl get pods -n jenkins
Get the default password from withing the log name of the pod.
- kubectl logs ${pod_name} -n jenkins
For Gitea integration, we will not be using gitea plugin but creating a webhook in gitea and linking it with Jenkins Project.
Create a new Project in Jenkins. This project will be using git for SCM (Source Code Management).
- Install the Gogs plugin.
- Click on 'New Item' option on the Jenkins UI Dashboard.
- Enter the name of the Project and select 'Freestyle Project' option. Click OK.
- In the 'Source Code Management' section, select git.
- Specify the repository url
- Add credentials
- Click Add -> Jenkins.
- For Kind as 'Username with password' -- Enter the username of Gitea Account you want to use. -- Enter the password for the account. -- Give it an ID. -- Click Add. You should now be able to Select the created Credential from the drop down. -- Goto step 7.
- For Kind as 'Gitea Personal Access Token' -- Go to gitea and login with the account you want to use for Jenkins Credentials. -- Go to account settings and click on 'Applications' tab. -- Give the token a name and click 'Generate Token'. -- Copy this token and paste it in the 'Token' field in Jenkins Add Credential setting. -- Give this token an ID and click add. You should now be able to Select the created Credential from the drop down.
- In the 'Build Triggers' section, select 'Poll SCM' and leave the Schedule blank. Leaving it blank tells Jenkins to only run when triggered by a hook.
- Change other settings for the build as you wish and click Save.
- Go to the webhook setting for the repo you want.
- Click 'Add webhook' and select the type Gogs.
- In the url type - http://192.168.99.122:30000/gogs-webhook/?job=${jenkins_project_name}
- Make sure Trigger On 'Push Event' is selected.
- Click Update Webhook.
- Test the webhook by clicking 'Test Delivery'. This should trigger the project in Jenkins.
- The Jenkins dashboard will show your current project with the 'Last Success' field.