WKS on GCE

Prerequisites

  1. Install:

  2. Configure gcloud.

  3. If you have never used direnv, you need to set it up. It hooks itself into your shell to set/unset environment variables when you enter or leave a directory.

    eval "$(direnv hook bash)"
    
  4. Create an .envrc file with, for example, the following content (or change to appropriate values where relevant):

    export project="wks-tests"
    export zone="europe-west1-b"
    export user="$(whoami)"
    export network="${user}-demo"
    export image_project="centos-cloud"
    export image_family="centos-7"
    export network_interface="eth0"
    

    (see also: GCP images) and run:

    direnv allow
    

Create the WKS cluster

  1. Create the GCE network and instances:

    ./create-network.sh && ./create-instances.sh
    

    Note: In case cluster capacity for number of instances is reached, try using another zone in .envrc.

  2. Generate machines.yaml:

    ./generate-machines-manifest.sh
    
  3. Create & configure the WKS cluster:

    wksctl apply
    
  4. Generate the kubeconfig file

    wksctl kubeconfig
    

    This will print a line to the console similar to $ export KUBECONFIG=/[path to kubeconfig file]. Copy that line and paste it into any terminal you are using kubectl in.

  5. Ensure that everything’s working:

    kubectl get namespaces
    

    should return something like

    NAME          STATUS   AGE
    default       Active   1m59s
    kube-public   Active   1m59s
    kube-system   Active   1m59s
    system        Active   1m54s
    

Delete the WKS cluster

To delete your WKS cluster, run:

./delete-instances.sh && ./delete-network.sh