-
-
Save christianh814/2c56be4f1c77d62bc54f9a311bc72bcb to your computer and use it in GitHub Desktop.
Sample Windows Container Workload
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Namespace | |
metadata: | |
creationTimestamp: null | |
name: win-test-workload | |
spec: {} | |
status: {} | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
name: win-webserver | |
namespace: win-test-workload | |
labels: | |
app: win-webserver | |
spec: | |
ports: | |
- port: 80 | |
protocol: TCP | |
targetPort: 80 | |
selector: | |
app: win-webserver | |
status: | |
loadBalancer: {} | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
labels: | |
app: win-webserver | |
name: win-webserver | |
namespace: win-test-workload | |
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:2004 | |
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>Windows Container Web Server</H1></body></html>'; $buffer = [System.Text.Encoding]::UTF8.GetBytes($content); $response.ContentLength64 = $buffer.Length; $response.OutputStream.Write($buffer, 0, $buffer.Length); $response.Close(); }; | |
nodeSelector: | |
kubernetes.io/os: windows | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment