In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-14 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces in detail the method of kubernetes installation and configuration of Jenkins service, the picture and text explanation is easy to learn, very suitable for beginners, interested friends can refer to.
1. Install Jenkins
# prepare Java environment tar xvf jdk-8u231-linux-x64.tar.gz-C / usr/local/cd / usr/local/ln-s jdk1.8.0_231 javacat / etc/profile.d/javaexport JAVA_HOME=/usr/local/javaexport PATH=$PATH:$JAVA_HOME/binsource / etc/profile.d/javajava-version
Yum-y install wgetwget-O / etc/yum.repos.d/jenkins.repo http://pkg.jenkins-ci.org/redhat/jenkins.reporpm-- import https://jenkins-ci.org/redhat/jenkins-ci.org.keyyum-- showduplicates list jenkins | expand # View the version to be installed yum-y install jenkins # install the latest vim / etc/sysconfig/jenkins # by default, modify the Jenkins configuration file as needed
Start
Systemctl start jenkins
Ss-anutlp | grep 8080 # to see if it has been started
2. Web interface settings
View the administrator password:
Cat / var/lib/jenkins/secrets/initialAdminPassword
Choose the recommended plug-in here and choose it according to your own needs.
It takes a long time to install. If any installation fails, click reinstall.
Create your administrator account, here I am logged in with the admin account, if the password is the same as the password to start cat.
Re-set the password for the admin user.
3. Install the plug-in
Plug-ins that need to be downloaded are: docker-build-step,docker,Maven Integration
4. Configure the environment
4.1 install git
Yum-y install git
4.2 install maven
Wget http://mirrors.tuna.tsinghua.edu.cn/apache/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gztar xvf apache-maven-3.6.3-bin.tar.gz-C / usr/localln-s apache-maven-3.6.3 mavencat / etc/profile.d/mavenexport MAVEN_HOME=/usr/local/mavenexport PATH=$MAVEN_HOME/bin:$PATHsource / etc/profile.d/mavenmvn-- version
4.3 install docker
Yum install-y yum-utils device-mapper-persistent-data lvm2yum-config-manager-- add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repoyum makecache fastyum install-y docker-ce-18.06.1.ce-3.el7systemctl start dockersystemctl status docker
4.4 Note: here I am using the company's private server. I need to configure the setting file, and my setting file is placed under / opt/.
5. Configure the global environment
5.1 configure docker
Pull to the bottom and choose to create a cloud, set the name, and url.
5.2 configure maven,jdk,git
Save after configuration!
6. Configure the project
Choose to build the maven project
Select git
Here you need to create a remote clone code user who must exist in your gitlab code user group and have permission to clone code
Then select the user you just created. The production environment is not configured for automatic construction, but needs to be self-configured.
Dckerfile file
FROM registry.hello.com/jdk:1.8_232 # this is my own jdk image ADD. / target/app.jar app.jarCMD ["java-jar app.jar-XX:+UnlockExperimentalVMOptions-XX:+UseCGroupMemoryLimitForHeap"]
# complete commands, modify according to your environment, and make examples. For more information, please see ssh root@192.16.6.89 "kubectl set image deployment/hello hello=registry.cn-hangzhou.aliyuncs.com/helloworld/hello:$ {BUILD_NUMBER}-n master" of the kebectl set image command.
Description: here is the Jenkins user to execute the command, will report an error Host key verification failed, you need to use the Jenkins user to create a key
Solution:
After installing jenkins, the system generates the ordinary user jenkins, but in / etc/passwd, his shell is / bin/false, so he cannot log in to the system and does not have a home directory. First, we modify his login permissions to change / bin/false to / bin/bash, and switch to the jenkins user, su.
-jenkins, whose terminal is displayed as-bash-4.2 $
Jenkins:x:997:995:Jenkins Automation Server:/var/lib/jenkins:/bin/bash
Generate jenkins user key pair
[root@bogon .ssh] # su-jenkins-bash-4.2$ ssh-keygen-t rsa enter-bash-4.2$ ssh-copy-id-I / var/lib/jenkins/.ssh/id_rsa.pub root@192.168.75.12
Use sudo to enhance the privileges of ordinary users
Use viduso to modify files, use commas between commands, and finally use visudo-c to check syntax errors.
Visudoroot ALL= (ALL) ALL # added to the original jenkins ALL= (ALL) NOPASSWD:/usr/bin/ssh,/usr/bin/rsync #
Finally, you can use the command command in jenkins to execute.
After the construction is successful
So far, the kubernetes installation and configuration of the Jenkins service has been successful. If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 277
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.