Я использую конвейер OpenShift Jenkins для создания приложения Node.JS. У меня есть следующая конфигурационная карта:
kind: ConfigMap
apiVersion: v1
metadata:
name: jenkins-agent
labels:
role: jenkins-slave
data:
nodejs: |-
<org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
<inheritFrom></inheritFrom>
<name>nodejs</name>
<instanceCap>2147483647</instanceCap>
<idleMinutes>0</idleMinutes>
<label>nodejs</label>
<serviceAccount>jenkins</serviceAccount>
<nodeSelector></nodeSelector>
<volumes/>
<containers>
<org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
<name>nodejs</name>
<image>image-registry.openshift-image-registry.svc:5000/openshift/jenkins-agent-nodejs:latest</image>
<privileged>false</privileged>
<alwaysPullImage>true</alwaysPullImage>
<workingDir>/tmp</workingDir>
<command></command>
<args></args>
<ttyEnabled>false</ttyEnabled>
<resourceRequestCpu></resourceRequestCpu>
<resourceRequestMemory></resourceRequestMemory>
<resourceLimitCpu></resourceLimitCpu>
<resourceLimitMemory></resourceLimitMemory>
<envVars/>
</org.csanchez.jenkins.plugins.kubernetes.ContainerTemplate>
</containers>
<envVars/>
<annotations/>
<imagePullSecrets/>
<nodeProperties/>
</org.csanchez.jenkins.plugins.kubernetes.PodTemplate>
Подчиненный модуль появляется и d ie из-за второго контейнера jnlp, который я не нахожу в журналах отслеживаемых.
$ oc describe pod nodejs-7gms8
Name: nodejs-7gms8
Namespace: pentest1
Priority: 0
Node: ip-[ip].ap-southeast-1.compute.internal/[ip]
Start Time: Thu, 18 Jun 2020 08:00:51 +0000
Labels: jenkins=slave
jenkins/nodejs=true
Annotations: k8s.v1.cni.cncf.io/networks-status:
[{
"name": "openshift-sdn",
"interface": "eth0",
"ips": [
"172.16.15.251"
],
"default": true,
"dns": {}
}]
openshift.io/scc: restricted
Status: Running
IP: 172.16.15.251
IPs: <none>
Containers:
nodejs:
Container ID: cri-o://52263361a13ed6eed048f58d56383b6cd6c2d2e59cd4b93f8aaab18bc600cbd0
Image: image-registry.openshift-image-registry.svc:5000/openshift/jenkins-agent-nodejs:latest
Image ID: image-registry.openshift-image-registry.svc:5000/openshift/jenkins-agent-nodejs@sha256:b4d61b125b61cc566dacf1bcd55b93aea908749009e0aacf6acedb7786fb226e
Port: <none>
Host Port: <none>
State: Terminated
Reason: Completed
Exit Code: 0
Started: Thu, 18 Jun 2020 08:01:38 +0000
Finished: Thu, 18 Jun 2020 08:01:41 +0000
Ready: False
Restart Count: 0
Environment:
http_proxy:
no_proxy:
https_proxy:
HOME: /home/jenkins
Mounts:
/tmp from workspace-volume (rw)
/var/run/secrets/kubernetes.io/serviceaccount from jenkins-token-ml26r (ro)
jnlp:
Container ID: cri-o://3197637a96555033e4586cb3e42fd7a9c3c1bf07983b7ffb695aaa5cf4eca9e8
Image: jenkins/jnlp-slave:alpine
Image ID: docker.io/jenkins/jnlp-slave@sha256:d1bae9ca7174cb3570dc953400b284f9dd39afe410d24b22c3fd9c2bbf47ee26
Port: <none>
Host Port: <none>
State: Running
Started: Thu, 18 Jun 2020 08:01:41 +0000
Ready: True
Restart Count: 0
Environment:
JENKINS_SECRET: ffeda6337faee73be38d16588a93641d6b36efd8da39195d183a337e0312a9e8
http_proxy:
no_proxy:
JENKINS_TUNNEL: [ip]:50000
JENKINS_AGENT_NAME: nodejs-7gms8
https_proxy:
JENKINS_NAME: nodejs-7gms8
JENKINS_AGENT_WORKDIR: /home/jenkins/agent
JENKINS_URL: http://[ip]:80/
HOME: /home/jenkins
Mounts:
/home/jenkins/agent from workspace-volume (rw)
/var/run/secrets/kubernetes.io/serviceaccount from jenkins-token-ml26r (ro)
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
workspace-volume:
Type: EmptyDir (a temporary directory that shares a pod's lifetime)
Medium:
SizeLimit: <unset>
jenkins-token-ml26r:
Type: Secret (a volume populated by a Secret)
SecretName: jenkins-token-ml26r
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 52s default-scheduler Successfully assigned pentest1/nodejs-7gms8 to ip-[ip].ap-southeast-1.compute.internal
Normal Pulling 43s kubelet, ip-[ip].ap-southeast-1.compute.internal Pulling image "image-registry.openshift-image-registry.svc:5000/openshift/jenkins-agent-nodejs:latest"
Normal Pulled 10s kubelet, ip-[ip].ap-southeast-1.compute.internal Successfully pulled image "image-registry.openshift-image-registry.svc:5000/openshift/jenkins-agent-nodejs:latest"
Normal Created 6s kubelet, ip-[ip].ap-southeast-1.compute.internal Created container nodejs
Normal Started 5s kubelet, ip-[ip].ap-southeast-1.compute.internal Started container nodejs
Normal Pulled 5s kubelet, ip-[ip].ap-southeast-1.compute.internal Container image "jenkins/jnlp-slave:alpine" already present on machine
Normal Created 2s kubelet, ip-[ip].ap-southeast-1.compute.internal Created container jnlp
Normal Started 2s kubelet, ip-[ip].ap-southeast-1.compute.internal Started container jnlp
$ oc logs -f nodejs-7gms8 -c jnlp
rpc error: code = Unknown desc = container with ID starting with 3197637a96555033e4586cb3e42fd7a9c3c1bf07983b7ffb695aaa5cf4eca9e8 not found: ID does not exist[
Мне удается собрать логи внутри коляски:
[ec2-user@release-sit nodejs-testrestapi]$ oc logs -f nodejs-gkn39 -c jnlp
Jun 18, 2020 8:16:27 AM hudson.remoting.jnlp.Main createEngine
INFO: Setting up agent: nodejs-gkn39
Jun 18, 2020 8:16:27 AM hudson.remoting.jnlp.Main$CuiListener <init>
INFO: Jenkins agent is running in headless mode.
Jun 18, 2020 8:16:27 AM hudson.remoting.Engine startEngine
INFO: Using Remoting version: 4.3
Jun 18, 2020 8:16:27 AM org.jenkinsci.remoting.engine.WorkDirManager initializeWorkDir
INFO: Using /home/jenkins/agent/remoting as a remoting work directory
Jun 18, 2020 8:16:27 AM org.jenkinsci.remoting.engine.WorkDirManager setupLogging
INFO: Both error and output logs will be printed to /home/jenkins/agent/remoting
Jun 18, 2020 8:16:27 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Locating server among [http://[ip]:80/]
Jun 18, 2020 8:16:27 AM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver openURLConnection
WARNING: Not using http_proxy environment variable which is invalid.
java.net.MalformedURLException: no protocol:
at java.net.URL.<init>(URL.java:593)
at java.net.URL.<init>(URL.java:490)
at java.net.URL.<init>(URL.java:439)
at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.openURLConnection(JnlpAgentEndpointResolver.java:526)
at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.resolve(JnlpAgentEndpointResolver.java:209)
at hudson.remoting.Engine.innerRun(Engine.java:693)
at hudson.remoting.Engine.run(Engine.java:518)
Jun 18, 2020 8:16:27 AM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting server accepts the following protocols: [JNLP4-connect, Ping]
Jun 18, 2020 8:16:27 AM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver resolve
INFO: Remoting TCP connection tunneling is enabled. Skipping the TCP Agent Listener Port availability check
Jun 18, 2020 8:16:27 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Agent discovery successful
Agent address: [ip]
Agent port: 50000
Identity: 9b:16:a0:dd:61:7b:19:6f:ed:be:1d:36:86:6f:57:01
Jun 18, 2020 8:16:27 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Handshaking
Jun 18, 2020 8:16:27 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connecting to 172.19.15.100:50000
Jun 18, 2020 8:16:27 AM org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver getResolvedHttpProxyAddress
WARNING: Not using http_proxy environment variable which is invalid.
java.net.MalformedURLException: no protocol:
at java.net.URL.<init>(URL.java:593)
at java.net.URL.<init>(URL.java:490)
at java.net.URL.<init>(URL.java:439)
at org.jenkinsci.remoting.engine.JnlpAgentEndpointResolver.getResolvedHttpProxyAddress(JnlpAgentEndpointResolver.java:499)
at org.jenkinsci.remoting.engine.JnlpAgentEndpoint.open(JnlpAgentEndpoint.java:194)
at hudson.remoting.Engine.connectTcp(Engine.java:844)
at hudson.remoting.Engine.innerRun(Engine.java:722)
at hudson.remoting.Engine.run(Engine.java:518)
Jun 18, 2020 8:16:27 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Trying protocol: JNLP4-connect
Jun 18, 2020 8:16:27 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Remote identity confirmed: 9b:16:a0:dd:61:7b:19:6f:ed:be:1d:36:86:6f:57:01
^[[AJun 18, 2020 8:16:28 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Connected Jun 18, 2020 8:16:31 AM org.csanchez.jenkins.plugins.kubernetes.KubernetesSlave$SlaveDisconnector call
INFO: Disabled slave engine reconnects.
Jun 18, 2020 8:16:31 AM hudson.remoting.jnlp.Main$CuiListener status
INFO: Terminated
rpc error: code = Unknown desc = container with ID starting with d577e897524d8e5b61d7f46e5c11aae33754206280d9117bf7b48397a5bdead1 not found: ID does not exist[
$ oc version
Client Version: openshift-clients-4.3.0-201910250623-88-g6a937dfe
Server Version: 4.2.21
Kubernetes Version: v1.14.6+06eeef5
Как это исправить? Спасибо.
Похоже, ваш пост - это в основном код; пожалуйста, добавьте подробнее ... бла ... бла ... бла ... бла