Steps to deploy a Windows container on Google Kubernetes Engine (GKE)
Update gcloud to latest:
gcloud components update --quiet
Set a cluster name and zone:
export CLUSTER_NAME=windows-cluster
export ZONE=europe-west1-b
gcloud config set compute/zone ${ZONE}
Create a GKE cluster on rapid channel and ip-alias enabled:
gcloud beta container clusters create ${CLUSTER_NAME} \
--enable-ip-alias \
--num-nodes=2 \
--release-channel=rapid
Create a Windows node-pool:
gcloud container node-pools create windows-node-pool \
--cluster=${CLUSTER_NAME} \
--image-type=WINDOWS_LTSC \
--no-enable-autoupgrade \
--machine-type=n1-standard-2
Enable kubectl to work with the cluster:
gcloud container clusters get-credentials ${CLUSTER_NAME}
Ensure that the webhook for Windows containers is created:
kubectl get mutatingwebhookconfigurations
NAME CREATED AT
...
windows.config.common-webhooks.networking.gke.io 2020-01-20T15:09:16Z
Create an iis.yaml deployment file with windows node selector:
nodeSelector:
kubernetes.io/os: windows
Create the deployment:
kubectl apply -f iis.yaml
deployment.apps/iis created
Expose the deployment behind a service:
kubectl expose deployment iis \
--type=LoadBalancer \
--name=iis
Validate that pods are running:
kubectl get pods
NAME READY STATUS RESTARTS AGE
iis-85cbdcf7ff-xc6r2 1/1 Running 0 6m45s
Validate that the service has an external ip:
kubectl get service iis
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
iis LoadBalancer 10.100.10.143 35.195.123.123 80:31318/TCP 5m26s
Test the Windows container:
curl http://${EXTERNAL_IP}