Skip to content

Windows Container - DevPreview 🔥

Checkout the Video from Christian Hernandez

Installation

Prerequisite

  • Create a AWS key pairs with name windows-ssh-key
1
2
3
4
5
cd ~/directory-to-store-cluster-data
docker run -ti -v ~/.aws/:/root/.aws:z -v $(pwd)/:/work:z quay.io/openshift-examples/windows-container-install-helper:latest
cd /work
# Run script, it's not perfect just for me to spinup a OpenShift 4 cluster with a windows worker
aws-create-cluster.sh

Demo applications

Run powershell.exe webserver

Note

the image size is 2GB! It take some time to pull the image

1
oc create -f https://gist.githubusercontent.com/suhanime/683ee7b5a2f55c11e3a26a4223170582/raw/d893db98944bf615fccfe73e6e4fb19549a362a5/WinWebServer.yaml

Sample APS.NET

1
2
oc new-project windows-container
oc label namespace windows-container "openshift.io/run-level=1"

Note

In order to deploy into a different namespace SCC must be disabled in that namespace. This should never be used in production, and any namespace that this has been done to should not be used to run Linux pods.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
oc create -f - <<EOF
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: sample-aspnetapp
  name: sample-aspnetapp
spec:
  replicas: 1
  selector:
    matchLabels:
      app: sample-aspnetapp
  strategy:
    type: Recreate
  template:
    metadata:
      labels:
        app: sample-aspnetapp
    spec:
      containers:
      - image: mcr.microsoft.com/dotnet/framework/samples:aspnetapp
        imagePullPolicy: IfNotPresent
        name: sample-aspnetapp
        ports:
        - containerPort: 80
          protocol: TCP
        resources: {}
        terminationMessagePath: /dev/termination-log
        terminationMessagePolicy: File
      dnsPolicy: ClusterFirst
      nodeSelector:
        beta.kubernetes.io/os: windows
      tolerations:
      - key: os
        value: Windows
EOF

oc create -f - <<EOF
apiVersion: v1
kind: Service
metadata:
  name: sample-aspnetapp
  labels:
    app: sample-aspnetapp
spec:
  ports:
    # the port that this service should serve on
  - port: 80
    targetPort: 80
  selector:
    app: sample-aspnetapp
  type: LoadBalancer
EOF

oc expose service/sample-aspnetapp

Last update: June 29, 2020