7.3. 샘플 Windows 컨테이너 워크로드 배포
Windows 컴퓨팅 노드를 사용 가능한 경우 Windows 컨테이너 워크로드를 클러스터에 배포할 수 있습니다.
참고
이 샘플 배포는 참조용으로만 제공됩니다.
예시 Service
오브젝트
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
예시 Deployment
오브젝트
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: containers: - name: windowswebserver image: mcr.microsoft.com/windows/servercore:ltsc2019 1 imagePullPolicy: IfNotPresent command: - powershell.exe 2 - -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: runAsNonRoot: false windowsOptions: runAsUserName: "ContainerAdministrator" os: name: "windows" runtimeClassName: windows2019 3
- 1
- 사용할 컨테이너 이미지를 지정합니다.
mcr.microsoft.com/powershell:<tag
> 또는mcr.microsoft.com/windows/servercore:<tag
> . 컨테이너 이미지는 노드에서 실행되는 Windows 버전과 일치해야 합니다.-
Windows 2019의 경우
ltsc2019
태그를 사용합니다. -
Windows 2022의 경우
ltsc2022
태그를 사용합니다.
-
Windows 2019의 경우
- 2
- 컨테이너에서 실행할 명령을 지정합니다.
-
mcr.microsoft.com/powershell:<tag
> 컨테이너 이미지의 경우 이 명령을pwsh.exe
로 정의해야 합니다. -
mcr.microsoft.com/windows/servercore:<tag
> 컨테이너 이미지의 경우 이 명령을powershell.exe
로 정의해야 합니다.
-
- 3
- 클러스터의 Windows 운영 체제 변형에 대해 생성한 런타임 클래스를 지정합니다.