job.yaml 784 B

123456789101112131415161718192021222324252627282930313233
  1. apiVersion: batch/v1
  2. kind: Job
  3. metadata:
  4. name: windows-hostprocess
  5. spec:
  6. backoffLimit: 0
  7. template:
  8. spec:
  9. restartPolicy: Never
  10. containers:
  11. - name: test
  12. image: mcr.microsoft.com/windows/servercore:ltsc2022
  13. command: [powershell, -File, C:\scripts\main.ps1]
  14. volumeMounts:
  15. - mountPath: C:\scripts
  16. name: scripts
  17. securityContext:
  18. windowsOptions:
  19. hostProcess: true
  20. runAsUserName: "NT AUTHORITY\\SYSTEM"
  21. hostNetwork: true
  22. tolerations:
  23. - key: "unschedulable"
  24. operator: "Equal"
  25. value: "true"
  26. effect: "NoSchedule"
  27. nodeSelector:
  28. "kubernetes.io/os": windows
  29. volumes:
  30. - name: scripts
  31. configMap:
  32. name: scripts