我是k8s的新手。试图在我的Mac上的kubernetes上设置Jenkins master。 使用docker-for-desktop提供的kubernetes集群。
下面是我的文件和配置
Dockerfile-Jenkins大师
FROM jenkins/jenkins:2.121.2
COPY plugins.txt /plugins.txt
RUN /usr/local/bin/install-plugins.sh $(cat /plugins.txt | tr '\n' ' ')
USER root
RUN apt-get update && apt-get install -y maven
USER jenkins
k8s-jenkins-deployment.yaml
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: jenkins
spec:
replicas: 1
template:
metadata:
labels:
app: jenkins
spec:
containers:
- name: jenkins
image: ybushnev/my-jenkins-image:1.0
env:
- name: JAVA_OPTS
value: -Djenkins.install.runSetupWizard=false
ports:
- name: http-port
containerPort: 8080
- name: jnlp-port
containerPort: 50000
volumeMounts:
- name: jenkins-home
mountPath: /var/jenkins_home
volumes:
- name: jenkins-home
emptyDir: {}
k8s-jenkins-service.yaml
apiVersion: v1
kind: Service
metadata:
name: jenkins
spec:
type: NodePort
ports:
- port: 8080
name: "http"
nodePort: 30000
targetPort: 8080
- port: 50000
name: "slave"
nodePort: 30010
targetPort: 50000
selector:
app: jenkins
下面是我如何为kubernetes插件配置云
下面是jnlp从站的pod模板
我尝试创建自由式作业,但从属代理不显示脱机显示。 下面是詹金斯大师的日志
INFO: Waiting for Pod to be scheduled (0/100): jenkins-slave-qbxjt
Oct 20, 2018 9:27:49 AM org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher launch
WARNING: Error in provisioning; agent=KubernetesSlave name: jenkins-slave-qbxjt, template=PodTemplate{inheritFrom='', name='jenkins-slave', namespace='', label='jenkins-slave', nodeSelector='', nodeUsageMode=NORMAL, workspaceVolume=EmptyDirWorkspaceVolume [memory=false], containers=[ContainerTemplate{name='jnlp', image='jenkinsci/jnlp-slave', alwaysPullImage=true, workingDir='/home/jenkins', command='/bin/sh -c', args='cat', resourceRequestCpu='', resourceRequestMemory='', resourceLimitCpu='', resourceLimitMemory='', livenessProbe=org.csanchez.jenkins.plugins.kubernetes.ContainerLivenessProbe@48e75450}], yaml=}
java.lang.IllegalStateException: Containers are terminated with exit codes: {jnlp=0}
at org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher.launch(KubernetesLauncher.java:156)
at hudson.slaves.SlaveComputer.call(SlaveComputer.java:292)
at jenkins.util.ContextResettingExecutorService.call(ContextResettingExecutorService.java:46)
at jenkins.security.ImpersonatingExecutorService.call(ImpersonatingExecutorService.java:71)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Oct 20, 2018 9:27:49 AM org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave _terminate
INFO: Terminating Kubernetes instance for agent jenkins-slave-qbxjt
Oct 20, 2018 9:27:49 AM okhttp3.internal.platform.Platform log
INFO: ALPN callback dropped: HTTP/2 is disabled. Is alpn-boot on the boot class path?
Oct 20, 2018 9:27:49 AM org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave deleteSlavePod
INFO: Terminated Kubernetes instance for agent default/jenkins-slave-qbxjt
Oct 20, 2018 9:27:49 AM org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave _terminate
INFO: Disconnected computer jenkins-slave-qbxjt
我看不到jnlp容器中的日志,而且它们也很快退出。
请告知并告知我是否需要更多信息