Jenkins在Debian上的集群部署方案可以参考以下步骤:
硬件与操作系统选择:
安装依赖与Jenkins:
sudo apt update && sudo apt install -y openjdk-11-jdksudo yum install -y java-11-openjdk-develsudo wget -O /usr/share/keyrings/jenkins-keyring.asc https://pkg.jenkins.io/debian-stable/jenkins.io.key echo "deb [signed-by=/usr/share/keyrings/jenkins-keyring.asc] https://pkg.jenkins.io/debian-stable binary/" | sudo tee /etc/apt/sources.list.d/jenkins.list sudo apt update && sudo apt install -y jenkins sudo wget -O /etc/yum.repos.d/jenkins.repo https://pkg.jenkins.io/redhat-stable/jenkins.repo sudo rpm --import https://pkg.jenkins.io/redhat-stable/jenkins.io.key sudo yum install -y jenkins sudo systemctl enable jenkins sudo systemctl start jenkins sudo systemctl status jenkins # 确认状态为Active sudo ufw allow 8080/tcp sudo ufw allow 50000/tcp sudo ufw reload http://<服务器IP>:8080,输入初始密码:sudo cat /var/lib/jenkins/secrets/initialAdminPassword。Manage Jenkins -> Plugin Manager -> Advanced,替换 Update Site URL 为:https://mirrors.tuna.tsinghua.edu.cn/jenkins/updates/update-center.json,安装必备插件:Pipeline、GitHub Integration、Docker、Kubernetes CLI、Credentials Binding。Manage Jenkins -> Security -> Enable security,选择 Logged-in users can do anything,创建管理员用户,设置用户名、密码和邮箱,避免使用默认账号“admin”。ssh-keygen -t rsa -b 4096 -f ~/.ssh/jenkins_github,复制公钥到GitHub的Deploy Keys。Manage Jenkins -> Credentials -> System -> Global credentials,添加SSH私钥(类型:SSH Username with private key),ID命名为 github-ssh。Pipeline script from SCM,配置Git仓库地址与凭据。docker run -d --name jenkins-agent \ -v /var/run/docker.sock:/var/run/docker.sock \ -e JENKINS_URL=http://master-ip:8080 \ -e JENKINS_AGENT_NAME=agent 以上步骤提供了一个基本的Jenkins集群部署方案,具体配置可能需要根据实际环境和需求进行调整。