AWS - Kubernetes upgrades#
Introduction#
This guide upgrades the Kubernetes version of an EKS cluster that runs Hopsworks, such as one created with the AWS getting started guide. The commands use eksctl, as that guide does.
Most node groups are updated in place. The node groups that run RonDB data nodes need care. EKS moves the pods off one node at a time, and the second data node of a RonDB node group can leave its node only after the first has restarted elsewhere. Depending on how long a data node takes to restart, its node group is updated in place or replaced by a new one.
Before you start#
- Upgrade one minor version at a time.
- The target version must be one that every Helm release on the cluster admits.
helm show chartprints a chart'skubeVersion: the Hopsworks chart 5.2 admits up to 1.37. Check the controllers you installed yourself too, such as the AWS Load Balancer Controller, and read the Kubernetes sections of the upgrade guide. - If Karpenter manages nodes, it runs a version that supports the target version, from its compatibility matrix.
- Every node runs the control plane's current version, which
kubectl get nodesshows. -
Every RonDB data node is started: the second command counts as many
starteddata nodes as the first counts data node pods. The management server also lists the unused node slots of the configuration asnot connected, like a data node that is down, so count rather than read the list: -
A backup has completed, as described in Disaster Recovery.
Order#
-
Upgrade the control plane. The first command shows the plan and the second runs it:
-
Update the add-ons to versions for the new Kubernetes version that also support the nodes still on the old one.
eksctl utils describe-addon-versions --kubernetes-version 1.37 --name ADDON_NAMElists the versions of an add-on. CoreDNS must keep the block that sends the Consul domain to Consul, as described in CoreDNS. -
Update the node groups without RonDB data nodes in place, one at a time:
EKS adds nodes on the new version, then drains the old ones one by one. A pod that a PodDisruptionBudget covers leaves only when the budget allows it. With asynchronous upload of HopsFS on, a DataNode can take its whole drain budget to stop, about an hour by default as described in Sizing the drain budget, longer than the 15 minutes EKS waits for a node's pods. Before such a node group's update, drain its DataNodes by hand, as described in Draining a DataNode by hand.
Nodes that Karpenter manages are replaced as drifted once the control plane runs the new version.
-
Upgrade the node groups with RonDB data nodes one at a time, in place or by replacement, as described in RonDB data nodes.
- Run the checks.
CoreDNS#
Hopsworks reaches its services by their names in the Consul domain, which CoreDNS forwards to Consul.
- If the Consul block is in the configuration of the CoreDNS add-on, as on a private EKS cluster, an update of the add-on keeps it.
- If the chart added it to the
corednsConfigMap, the default, update the add-on with conflict resolutionPRESERVE, which keeps changes made in the cluster.OVERWRITEremoves the block, and Hopsworks then fails to resolve its services, as described inopensearch-index-upgradegets no answer.
Check the Corefile right after the update:
It has a block for the Consul domain: consul with the chart's default, consul:53 on a private EKS cluster.
RonDB data nodes#
The data nodes of each RonDB node group run as a StatefulSet, each on a Kubernetes node of its own. A PodDisruptionBudget of the chart keeps at least one data node of each node group available, which with the default of two data nodes per node group lets one leave at a time. kubectl get pdb -n hopsworks shows one allowed disruption for each node-group-* budget while every data node is started. A data node is ready only once the management server reports it started, which takes longer the more data it holds. Its volume stays in its availability zone, so a node group that runs data nodes needs nodes in the zones of their volumes.
With one data node per node group, clusterSize.activeDataReplicas: 1, the chart creates no budget. Both paths below then stop RonDB while that data node restarts, so plan a maintenance window for it.
Never on a node group with data nodes
- The force update of a node group,
--force-upgradein eksctl, deletes pods whatever their budgets allow, which can stop every data node of a node group at once. - Removing or terminating instances of the node group by hand can make the Auto Scaling group rebalance its zones and terminate another instance, one that runs a data node.
- A PodDisruptionBudget of your own that selects Hopsworks pods: a pod that two budgets select cannot be evicted, and the update fails.
Choosing the path#
EKS gives the pods of each old node 15 minutes to leave, and fails the update with PodEvictionFailure when they have not. The first data node of a node group leaves at once. Its peer can leave only after the first has restarted on a new node and is started again. The in-place update therefore works only when a data node restarts, its volume moved to a new node included, well within those 15 minutes.
Estimate the restart from what you know of the cluster, such as the restarts during a past Hopsworks upgrade or node update. The management server logs each start of a data node in its cluster log, from Start phase 0 completed, followed by the kind of start, to Started:
kubectl exec -n hopsworks mgmds-0 -c mgmd -- sh -c "grep -h -e 'Start phase 0 completed' -e ': Started (' /srv/hops/mysql-cluster/log/cluster.log*"
An upgrade restarts one data node at a time while its peer runs, a node restart, which also takes over from the peer the changes made while the node was down. A move to a new node adds the time to detach the volume and attach it there. The restart takes longer as the data grows, so a past restart with less data underestimates it. Update in place when the estimate is well within 15 minutes, otherwise replace the node group.
In place#
The node group must have nodes in the zones of the data nodes' volumes, and update one node at a time, the EKS default.
EKS adds nodes for the update and removes nodes when it ends, so a data node that lands on a node removed at the end moves a second time. When the update has finished, check that every data node is started, as in Before you start.
If the update stops with PodEvictionFailure:
- Wait until the update has ended, which
eksctl get nodegroup --cluster CLUSTER_NAMEshows as the node group's status. - The error names the pod that did not leave.
kubectl get pdb -n hopsworksshows its budget, which allows no disruption while a data node of its node group is not ready. - Wait until every data node is started again.
- Finish the node group by replacement.
By replacement#
A new node group, with a label and taint of its own, takes the data nodes, and the old node group is deleted once they have left. EKS evicts nothing: a change of the data nodes' placement in the Hopsworks values moves them. The steps use the node groups of Optional: dedicated node groups and the values of Dedicated node pools. If the data nodes share a node group with other pods, the same steps move only the data nodes to a node group of their own, and the old node group is then updated in place instead of deleted.
- Check that every data node is started, as in Before you start, and that a backup has completed.
-
Find the zones of the data nodes' volumes:
-
Add a node group to
eksctl.yamlnext to the old one, with a name, label and taint of its own, nodes in those zones, and as many nodes as data nodes:- name: rondb2 amiFamily: AmazonLinux2023 instanceType: m6i.xlarge availabilityZones: [ZONE_A, ZONE_B] minSize: 2 maxSize: 2 desiredCapacity: 2 volumeSize: 100 labels: node: RonDB2 taints: - key: node value: RonDB2 effect: NoSchedule # the rest as the old node group: iam, and privateNetworking on a private clusterCopy the other settings of the old node group, such as its IAM and, on a private EKS cluster,
privateNetworking: true. Setmetadata.versionin the file to the new version,"1.37": eksctl creates the node group on that version, and only warns when the control plane runs another. Then create it:The EC2 quotas of the account must allow both node groups at once.
-
In the release's values, the file of Dedicated node pools when you use it, point both data node settings at the new label:
rondb: rondb: nodeSelector: ndbmtd: node: RonDB2 tolerations: ndbmtd: - key: "node" operator: "Equal" value: "RonDB2" effect: "NoSchedule"Keep the change in that file: a later
helm upgradewith the old label moves the data nodes back, or leaves them pending once the old node group is gone. -
Check again that every data node is started, then run
helm upgradewith the chart version of the release and the same values files, in the same order, as its last install or upgrade. Give it a--timeoutlong enough for every data node to restart. The data nodes of a node group move one at a time, each after the previous one has started, and their volumes move with them. With more than one RonDB node group, one data node of each moves at the same time, so each node group runs on a single copy meanwhile. With sequenced rollouts on,rondb.rondb.ndbmtdSequencedRollout.enabled,helm upgradereturns before any data node moves, and a CronJob of the chart then moves the node groups one after the other: wait at step 6 until every data node runs on the new node group. -
Check that every data node runs on a node of the new node group and is started:
-
Check that only DaemonSet pods are left on the old nodes, terminating pods included:
-
Delete the old node group while it is still in
eksctl.yaml, then remove it from the file:Without
--include, the command selects every node group in the file.
The next upgrade replaces rondb2 by a node group with yet another label, or with RonDB again.
Check#
kubectl get nodesshows every node on the new version.- Every RonDB data node is started.
- The
Corefilehas the Consul block. -
Every Hopsworks pod is running or completed:
-
A Hopsworks job, such as an insert into a Feature Group, runs to the end. If it fails to resolve a name in the Consul domain, look for errors forwarding to Consul in the CoreDNS logs: