If you need a Windows environment as part of a Tekton Task or Pipeline, you can include Windows container images in your Task steps. Because Windows containers can only run on a Windows host, you will need to have Windows nodes available in your Kubernetes cluster. You should read Windows support in Kubernetes to understand the functionality and limitations of Kubernetes on Windows.
Some important things to note about Windows containers and Kubernetes:
Some important things to note about Windows support in Tekton:
In order to ensure that Tasks are scheduled to a node with the correct host OS, you will need to update the TaskRun or PipelineRun spec with rules to define this behaviour. This can be done in a couple of different ways, but the simplest option is to specify a node selector.
Node selectors are the simplest way to schedule pods to a Windows or Linux node. By default, Kubernetes nodes include a label kubernetes.io/os
to identify the host OS. The Kubelet populates this with runtime.GOOS
as defined by Go. Use spec.podTemplate.nodeSelector
(or spec.taskRunSpecs[i].podTemplate.nodeSelector
in a PipelineRun) to schedule Tasks to a node with a specific label and value.
For example:
apiVersion: tekton.dev/v1
kind: TaskRun
metadata:
name: windows-taskrun
spec:
taskRef:
name: windows-task
podTemplate:
nodeSelector:
kubernetes.io/os: windows
---
apiVersion: tekton.dev/v1
kind: TaskRun
metadata:
name: linux-taskrun
spec:
taskRef:
name: linux-task
podTemplate:
nodeSelector:
kubernetes.io/os: linux
Node affinity can be used as an alternative method of defining the OS requirement of a Task. These rules can be set under spec.podTemplate.affinity.nodeAffinity
in a TaskRun definition. The example below produces the same result as the previous example which used node selectors.
For example:
apiVersion: tekton.dev/v1
kind: TaskRun
metadata:
name: windows-taskrun
spec:
taskRef:
name: windows-task
podTemplate:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- windows
---
apiVersion: tekton.dev/v1
kind: TaskRun
metadata:
name: linux-taskrun
spec:
taskRef:
name: linux-task
podTemplate:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/os
operator: In
values:
- linux
Вы можете оставить комментарий после Вход в систему
Неприемлемый контент может быть отображен здесь и не будет показан на странице. Вы можете проверить и изменить его с помощью соответствующей функции редактирования.
Если вы подтверждаете, что содержание не содержит непристойной лексики/перенаправления на рекламу/насилия/вульгарной порнографии/нарушений/пиратства/ложного/незначительного или незаконного контента, связанного с национальными законами и предписаниями, вы можете нажать «Отправить» для подачи апелляции, и мы обработаем ее как можно скорее.
Опубликовать ( 0 )