This documentation is for a release that is no longer maintained
See documentation for the latest supported version 3 or the latest supported version 4.6.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: 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: runAsNonRoot: false windowsOptions: runAsUserName: "ContainerAdministrator" nodeSelector: kubernetes.io/os: windows
참고
mcr.microsoft.com/powershell:<tag>
컨테이너 이미지를 사용하는 경우 이 명령을 pwsh.exe
로 정의해야 합니다. mcr.microsoft.com/windows/servercore:<tag>
컨테이너 이미지를 사용하는 경우 해당 명령을 powershell.exe
로 정의해야 합니다. 자세한 내용은 Microsoft 문서를 참조하십시오.