fbpx

In this tutorial, you will learn how to update the Spotinst controller in your K8s cluster, in case an update is required:

  • In case you are using K8s version below 1.9, please run the following command:
    kubectl apply -f http://spotinst-public.s3.amazonaws.com/integrations/kubernetes/cluster-controller/spotinst-kubernetes-cluster-controller.yaml
  • In case you are using K8’s version 1.9 and above, then you will need to install the GA version of the controller:
  1. Prior to upgrading the latest GA controller version, you would have to delete any non GA version controllers:
    a. Collect the details of all of the Spotinst deployments:

    kubectl get deploy --namespace kube-system

    b. Based on the above output, you will need to delete all of the Spotinst Deployments, please see the example below:

    kubectl delete deployment spotinst-kubernetes-cluster-controller -n kube-system
  2. Install the latest GA controller version:

    kubectl apply -f https://s3.amazonaws.com/spotinst-public/integrations/kubernetes/cluster-controller/spotinst-kubernetes-cluster-controller-ga.yaml

     

In case the controller is already installed, this action will start a roll in the cluster, which will launch a new pod and terminate the old one.
When the controller is booting up, it prints the version in the log.

Moreover, the controller supports auto update. Meaning, when a new version of the controller is available, it will automatically be updated.                                         By default, the auto-update is enabled.

Enable \ Disable Automatic Updates:

*As a best-practice, Spotinst recommends enabling the Auto-Update flag, due to the fact that the update procedure is silent and requires no downtime.                  In addition to that, every controller version update improves stability and performance, collects new metrics, and supports new K8s versions.

  • Note: In case you are running a Spotinst Controller with a version under 1.0.2.8, there is a need to update the controller manually to a more recent version. Afterwards, you will be able to enjoy the Auto-Update functionality.

In case you wish to disable the auto update, follow these instructions:

  1. Download the Spotinstcontroller YAML file using this link:
    https://s3.amazonaws.com/spotinst-public/integrations/kubernetes/cluster-controller/spotinst-kubernetes-cluster-controller.yaml
  2. Edit the file and add the DISABLE_AUTO_UPDATE variable as true under the Deployment resource as follows:
kind: Deployment
apiVersion: apps/v1beta1
metadata:
  labels:
    k8s-app: spotinst-kubernetes-cluster-controller
  name: spotinst-kubernetes-cluster-controller
  namespace: kube-system
spec:
  replicas: 1
  revisionHistoryLimit: 10
  selector:
    matchLabels:
      k8s-app: spotinst-kubernetes-cluster-controller
  template:
    metadata:
      labels:
        k8s-app: spotinst-kubernetes-cluster-controller
    spec:
      containers:
      - name: spotinst-kubernetes-cluster-controller
        imagePullPolicy: Always
        image: spotinst/kubernetes-cluster-controller:1.0.14
        volumeMounts:
        - name: spotinst-kubernetes-cluster-controller-certs
          mountPath: /certs
        - name: tmp-volume
          mountPath: /tmp
        env:
           - name: SPOTINST_TOKEN
             valueFrom:
               configMapKeyRef:
                 name: spotinst-kubernetes-cluster-controller-config
                 key: spotinst.token
           - name: SPOTINST_ACCOUNT
             valueFrom:
               configMapKeyRef:
                 name: spotinst-kubernetes-cluster-controller-config
                 key: spotinst.account
           - name: CLUSTER_IDENTIFIER
             valueFrom:
               configMapKeyRef:
                 name: spotinst-kubernetes-cluster-controller-config
                 key: spotinst.cluster-identifier
           - name: DISABLE_AUTO_UPDATE
             value: "true"
      volumes:
      - name: spotinst-kubernetes-cluster-controller-certs
        secret:
          secretName: spotinst-kubernetes-cluster-controller-certs
      - name: tmp-volume
        emptyDir: {}
      serviceAccountName: spotinst-kubernetes-cluster-controller
      tolerations:
      - key: node-role.kubernetes.io/master
        effect: NoSchedule