-
Type:
Bug
-
Resolution: Not A Defect
-
Priority:
Blocker
-
Component/s: kubernetes-plugin
Hi,
I'm trying to get windows pods working on GKE but for both the jnlp and shell container I get the following errors:
Error: failed to start container "jnlp": Error response from daemon: CreateComputeSystem jnlp: The system cannot find the file specified.
Error: failed to start container "shell": Error response from daemon: CreateComputeSystem shell: The system cannot find the file specified.
This is using the sample pipeline:
/* * Runs a build on a Windows pod. * Tested in EKS: https://docs.aws.amazon.com/eks/latest/userguide/windows-support.html */ podTemplate(yaml: ''' apiVersion: v1 kind: Pod spec: containers: - name: jnlp image: jenkins/jnlp-agent:latest-windows - name: shell image: mcr.microsoft.com/powershell:preview-windowsservercore-1809 command: - powershell args: - Start-Sleep - 999999 nodeSelector: beta.kubernetes.io/os: windows ''') { node(POD_LABEL) { container('shell') { powershell 'Get-ChildItem Env: | Sort Name' } } }
Here's an outline the commands I used to setup the cluster:
gcloud beta container clusters create jenkins-cd \
--num-nodes 2 \
--machine-type n1-standard-2 \
--scopes "https://www.googleapis.com/auth/source.read_write,cloud-platform" \
--enable-ip-alias \
--release-channel=rapid
gcloud container clusters get-credentials jenkins-cd
gcloud beta container node-pools create windows-pool \
--cluster=jenkins-cd \
--image-type=WINDOWS_SAC \
--no-enable-autoupgrade \
--machine-type=n1-standard-2
wget https://get.helm.sh/helm-v2.16.1-linux-amd64.tar.gz tar zxfv helm-v2.16.1-linux-amd64.tar.gz cp linux-amd64/helm . kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --user=$(gcloud config get-value account) kubectl create serviceaccount tiller --namespace kube-system kubectl create clusterrolebinding tiller-admin-binding --clusterrole=cluster-admin --serviceaccount=kube-system:tiller ./helm init --service-account=tiller ./helm update ./helm version
./helm install -n cd stable/jenkins -f jenkins/values.yaml --version 1.2.2 --wait kubectl get pods export POD_NAME=$(kubectl get pods -l "app.kubernetes.io/component=jenkins-master" -o jsonpath="{.items[0].metadata.name}") kubectl port-forward $POD_NAME 8080:8080 >> /dev/null & kubectl get svc printf $(kubectl get secret cd-jenkins -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode);echo
Then I login into Jenkins and try to run the sample pipeline for windows but I cannot get it to work.
The following error also appears in the jenkins master log:
Error in provisioning; agent=KubernetesSlave name: windows-test-8-hn1vc-q3pg0-k4x83, template=PodTemplate{, name='windows-test_8-hn1vc-q3pg0', namespace='default', label='windows-test_8-hn1vc', nodeUsageMode=EXCLUSIVE, workspaceVolume=EmptyDirWorkspaceVolume [memory=false], annotations=[org.csanchez.jenkins.plugins.kubernetes.PodAnnotation@aab9c821, org.csanchez.jenkins.plugins.kubernetes.PodAnnotation@c92c82e4]}
java.lang.IllegalStateException: Pod has terminated containers: default/windows-test-8-hn1vc-q3pg0-k4x83 (jnlp, shell)
at org.csanchez.jenkins.plugins.kubernetes.AllContainersRunningPodWatcher.periodicAwait(AllContainersRunningPodWatcher.java:183)
at org.csanchez.jenkins.plugins.kubernetes.AllContainersRunningPodWatcher.periodicAwait(AllContainersRunningPodWatcher.java:204)
at org.csanchez.jenkins.plugins.kubernetes.AllContainersRunningPodWatcher.await(AllContainersRunningPodWatcher.java:144)
at org.csanchez.jenkins.plugins.kubernetes.KubernetesLauncher.launch(KubernetesLauncher.java:139)
at hudson.slaves.SlaveComputer.lambda$_connect$0(SlaveComputer.java:292)
at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
at jenkins.security.ImpersonatingExecutorService$2.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$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
I can deploy an image via kubectl apply -f jenkins-windows.yaml with the following template successfully:
apiVersion: apps/v1
kind: Deployment
metadata:
name: jenkins-windows
labels:
app: jenkins-windows
spec:
replicas: 0
selector:
matchLabels:
app: jenkins-windows
template:
metadata:
labels:
app: jenkins-windows
spec:
nodeSelector:
kubernetes.io/os: windows
containers:
- name: jnlp
image: jenkins/jnlp-agent:latest-windows
- name: shell
image: mcr.microsoft.com/powershell:preview-windowsservercore-1809
ports:
- containerPort: 80
I'm not sure how to debug this really. The error says The system cannot find the file specified but I am not sure what file this refers to. Is it related to workspaceVolume not being set? I would have thought the sample pipeline would work without that though (and I don't yet know how to configure that).
Any help would be really appreciated else I will have to drop Kubernetes and just use VMs.
For good measure here is also the log from the job:
Created Pod: windows-test-9-mdt6s-t2kj3-dsr2n in namespace default Still waiting to schedule task ‘windows-test-9-mdt6s-t2kj3-dsr2n’ is offline Created Pod: windows-test-9-mdt6s-t2kj3-dcqvw in namespace default Created Pod: windows-test-9-mdt6s-t2kj3-kvr05 in namespace default Created Pod: windows-test-9-mdt6s-t2kj3-k9v52 in namespace default Created Pod: windows-test-9-mdt6s-t2kj3-tbn3g in namespace default Created Pod: windows-test-9-mdt6s-t2kj3-2qv1t in namespace default Aborted by admin