Running this blog on Kubernetes - Part 2

  1. Get the fluxctl binary and save it on your path

    wget -O fluxctl
    sudo mv fluxctl_linux_amd64 /usr/local/sbin/fluxctl
  2. Create the namespace


Save the fluxcd ID and paste that into GitHub

fluxctl identity --k8s-fwd-ns flux

NOTE: If using a private registry for your images (such as Azure Container Registry), you will have to do a few more steps as described bellow.

  1. Create a secret with the credentials for the registry

    kubectl create secret docker-registry acrcreds          \                  \
    --docker-username=${DOCKER_USERNAME}                \
    --docker-password=${DOCKER_PASSWORD}                \               \
    -n dcasati-net
  2. Patch the service account so it has access to the secrets.

    kubectl patch serviceaccount default -p '{"imagePullSecrets": [{"name": "acrcreds"}]}'

XXX Need to test this

kubectl patch serviceaccount default -p '{"imagePullSecrets": [{"name": "acrcreds"}]}' -n flux
kubectl patch serviceaccount flux -p '{"imagePullSecrets": [{"name": "acrcreds"}]}' -n flux

You can manually do a sync at this point to validate that everything is working.

fluxctl sync --k8s-fwd-ns flux
  1. Setting up a LoadBalancer with a static IP address:

    az aks show -g dcasatinet -n alpha --query nodeResourceGroup -o tsv
    az network public-ip create -g MC_dcasati-net_alpha_southcentralus -n alpha-pip --allocation-method static --sku Standard

Add this IP address to the service.yaml file. It will look like this:

IPADDRESS=$(az network public-ip list -g  MC_dcasati-net_alpha_southcentralus --query "[?name=='alpha-pip']" -o json | jq  '.[0].ipAddress')
sed -E "s/(loadBalancerIP:)(.*)/\1 `echo $IPADDRESS | tr '"' " "`/" ../manifests/service.yaml | k apply -f -