1.5.x to 1.6.x
Here are the detailed instructions to upgradee the self costed controller from v1.5.x to v1.6.x.
Prerequisites¶
Make sure all the pods are up and running in the existing controller. Check if all the clusters are healthy.
Existing Controller Backup¶
We need to take the backup of the existing controller to avoid losing the old data.
DB backup¶
From postgres pods
kubectl exec -it -n rafay-core postgres-admin-0 bash
su - postgres
pg_dumpall -U postgres > /home/postgres/preupgrade_allDB.sql
From the controller copy it into the backup location
mkdir ~/backups
kubectl cp -n rafay-core postgres-admin-0:/home/postgres/preupgrade_allDB.sql ~/backups/preupgrade_allDB.sql
Secrets and Certificates backup¶
kubectl get secrets -A -o yaml > ~/backups/all_secrets.yaml
kubectl get certificates -A -o yaml > ~/backups/all_certificates.yaml
Take salt backup¶
Exec into the salt-master pod and backup the directories under it.
kubectl exec -it -n rafay-core <salt-master-pod> bash
kubectl cp -n rafay-core <salt-master-pod>:/etc/salt/pki ~/backups/salt-master
Upgrading the Controller¶
Once all the required files backup is complete, start upgrading the controller.
-
Click here to download the latest package for the upgrade
-
Untar the above tar package into the controller node and untar it
tar -xf rafay-controller-v1.6-1.22.tar.gz
- Once untarring the package into the controller node, backup the old config file into a new one
- Change the new config file with all the required changes as in the backed up config file
sudo mv ./radm /usr/bin/
$ mv config.yaml config.yaml-1-4-back
$ cp -rp config.yaml-tmpl config.yaml
$ vi config.yaml
$ diff -y config.yaml-1-4-back config.yaml
- Upgrade the rafay dependencies
sudo radm dependency --config config.yaml
- Wait until all pods are up and then upgrade the rafay application. This will take approximately 10 mins
kubectl get po -A
- Upgrade the rafay Applications
sudo radm application --config config.yaml
- Now delete the salt-master pod
kubectl delete pods -n rafay-core <salt-master>
- Upgrade the cluster config
sudo radm cluster --config config.yaml
Post Upgrade Migrations¶
- Clear all the browser cache, cookies
-
Login to the URL
https://ops-console.<controller-FQDN>
using the credentials passed in config.yaml under super-user section -
After login, hit the below API which triggers the DB migrations
https://ops-console.<controller-FQDN>/edge/v1/migrations/
- A plain screen without any error represents the migration is complete
DB Migrations¶
Use the below link for DB migrations
https://rafaysystems.atlassian.net/wiki/spaces/EN/pages/2278326283/1.6+Release+Migration+Steps
Admin-Api¶
- Once upgrading admin-api image, run the following commands:
# kubectl exec -it -n rafay-core <admin-api> sh
# python3 manage.py update_namespace_placement_policy
# python3 manage.py update_namespace_id_with_configv2_for_authsrv_tables
Upgrading the DB’s¶
- Exec into the postgres-admin-0 container to update the DB’s
kubectl exec -it -n rafay-core postgres-admin-0 sh
- Once your into the container run the following commands to get into the required DB’s
# su - postgres
# psql
# \c configv2db
# \copy (SELECT id as namespace_id, name as namespace_name FROM config_namespaces WHERE deleted_at is NULL) TO '/tmp/configv2namespaces.csv' WITH CSV
# \q
For admindb
$ psql
# \c admindb
# CREATE TEMP TABLE temp_namespaces (
namespace_id integer NOT NULL,
namespace_name varchar NOT NULL
);
# \copy temp_namespaces(namespace_id,namespace_name) FROM '/tmp/configv2namespaces.csv' DELIMITER ',' CSV;
# INSERT INTO sentry_namespaces (namespace_id, namespace_name)
SELECT
n.namespace_id,
n.namespace_name
FROM
temp_namespaces n;
# DROP TABLE temp_namespaces;
# \q
-
Once the required DB’s are updated, you can exit from the postgres
-
Check for pods
kubectl get po -A
- Once the controller upgrade is complete, bring up a new node and create a new cluster in v1.6-1.1 as in section 3.0
Cluster Upgrade¶
-
Once the controller is upgraded, all existing clusters can be upgraded via using blueprint sync
-
Edit the blueprint which is used for the existing clusters
- Create a new version of blueprint with the existing addons
- Name the blueprint with a new version number
- Trigger the blueprint sync from the cluster settings
- Select the new version of the blueprint created above and publish
- Once the Blueprint sync is complete, the cluster should be completely upgraded to v1.6