1
0
mirror of https://github.com/openshift/openshift-docs.git synced 2026-02-05 12:46:18 +01:00
Files
openshift-docs/modules/sample-windows-workload-deployment.adoc
W. Trevor King fabb9d287e modules: Update beta.kubernetes.io/os to kubernetes.io/os
Seen in a 4.9.7 cluster:

  $ oc apply -n openshift-insights -f gather-job.yaml
  W1118 20:24:47.058068    9468 warnings.go:70] spec.template.spec.nodeSelector[beta.kubernetes.io/os]: deprecated since v1.14; use "kubernetes.io/os" instead
  job.batch/insights-operator-job created

Docs on their deprecation in [1].

Generated with:

  $ sed -i 's|beta.kubernetes.io/os|kubernetes.io/os|g' $(git grep -l beta.kubernetes.io/os)

[1]: https://github.com/kubernetes/kubernetes/blob/master/CHANGELOG/CHANGELOG-1.14.md#deprecations
2021-11-19 20:26:21 +00:00

77 lines
2.3 KiB
Plaintext

// Module included in the following assemblies:
//
// * windows_containers/scheduling-windows-workloads.adoc
[id="sample-windows-workload-deployment_{context}"]
= Sample Windows container workload deployment
You can deploy Windows container workloads to your cluster once you have a Windows compute node available.
[NOTE]
====
This sample deployment is provided for reference only.
====
.Example `Service` object
[source,yaml]
----
apiVersion: v1
kind: Service
metadata:
name: win-webserver
labels:
app: win-webserver
spec:
ports:
# the port that this service should serve on
- port: 80
targetPort: 80
selector:
app: win-webserver
type: LoadBalancer
----
.Example `Deployment` object
[source,yaml]
----
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: win-webserver
name: win-webserver
spec:
selector:
matchLabels:
app: win-webserver
replicas: 1
template:
metadata:
labels:
app: win-webserver
name: win-webserver
spec:
tolerations:
- key: "os"
value: "Windows"
Effect: "NoSchedule"
containers:
- name: windowswebserver
image: mcr.microsoft.com/windows/servercore:ltsc2019
imagePullPolicy: IfNotPresent
command:
- powershell.exe
- -command
- $listener = New-Object System.Net.HttpListener; $listener.Prefixes.Add('http://*:80/'); $listener.Start();Write-Host('Listening at http://*:80/'); while ($listener.IsListening) { $context = $listener.GetContext(); $response = $context.Response; $content='<html><body><H1>Red Hat OpenShift + Windows Container Workloads</H1></body></html>'; $buffer = [System.Text.Encoding]::UTF8.GetBytes($content); $response.ContentLength64 = $buffer.Length; $response.OutputStream.Write($buffer, 0, $buffer.Length); $response.Close(); };
securityContext:
windowsOptions:
runAsUserName: "ContainerAdministrator"
nodeSelector:
kubernetes.io/os: windows
----
[NOTE]
====
When using the `mcr.microsoft.com/powershell:<tag>` container image, you must define the command as `pwsh.exe`. If you are using the `mcr.microsoft.com/windows/servercore:<tag>` container image, you must define the command as `powershell.exe`. For more information, see Microsoft's documentation.
====