# Upgrade Management Plane and Hosts

The upgrade of the self-hosted <code class="expression">space.vars.product\_name</code> consists of two-phase sequential upgrades.

* **Management Plane:** Upgrading the Management Plane updates core services, management APIs, region-specific configurations, and orchestration components.
* **Hosts**: Once the management plane is upgraded, hosts in each region must be upgraded to ensure compatibility, seamless communication, and completion of the overall upgrade process.

Before you begin the upgrade, ensure you meet all prerequisites.

## Prerequisites for Upgrade

### Manual Backup

You must perform a [manual backup](https://docs.platform9.com/private-cloud-director/2025.4/getting-started/backup-and-restore#manual-backup-procedure) manual backup of your management plane infrastructure before starting the upgrade. This backup is critical for recovery.

{% hint style="info" %}
**Note**

You are required to perform an additional manual backup if your metrics services (**gnocchi**) or your storage uses `hostpath-provisioner.` In this case, save the data from the RabbitMQ pod’s `/var/lib/rabbitmq/` directory.
{% endhint %}

## Upgrade Management Plane

Updating the Management Plane running on the Management Cluster, ensures multiple components are automatically upgraded as a part of an `airctl upgrade` process. Here are the components that will be affected.

* Core services and applications.
* Management APIs and user interfaces.
* Region-specific configurations and services.
* Service coordination and orchestration components.

### The Impact from Management Plane Upgrade

> Temporary service interruptions may occur during the upgrade process.

* The user interface will be unavailable for the duration of the upgrade.
* All API services will be temporarily unavailable.
* Create, Read, Update, and Delete operations will not be possible during this time.
* **Running workloads on VMs will not be impacted.**

#### Step 1: Download and Run Installer Artifacts

`airctl` is the command-line installer for Private Cloud Director. Run the following commands **only on a verified management cluster node** to download `airctl` along with the required installation artifacts.

1. Download the Installer Script and Artifacts using the following command.

{% tabs %}
{% tab title="Bash" %}

```bash
curl --user-agent "<YOUR-USER-AGENT-KEY>" https://pf9-airctl.s3-accelerate.amazonaws.com/latest/index.txt | awk '{print "curl -sS --user-agent \"<YOUR-USER-AGENT-KEY>\" \"https://pf9-airctl.s3-accelerate.amazonaws.com/latest/" $NF "\" -o ${HOME}/" $NF}' | bash
```

{% endtab %}
{% endtabs %}

You can choose to download a specific version of the installer script and artifact. For example, you can replace `latest` with a specific version, such as `v-2025.4.2-3833462`. Here is a sample modified command:

{% tabs %}
{% tab title="Bash" %}

```bash
curl --user-agent "<YOUR-USER-AGENT-KEY>" https://pf9-airctl.s3-accelerate.amazonaws.com/v-2025.4.2-3833462/index.txt | \
awk '{print "curl -sS --user-agent \"<YOUR-USER-AGENT-KEY>\" \"https://pf9-airctl.s3-accelerate.amazonaws.com/v-2025.4.2-3833462/" $NF "\" -o ${HOME}/" $NF}' | bash
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Note**

Replace `<YOUR-USER-AGENT-KEY>` with your user key.
{% endhint %}

2. Make the Installer Executable using the following command.

{% tabs %}
{% tab title="Bash" %}

```bash
chmod +x ./install-pcd.sh
```

{% endtab %}
{% endtabs %}

3. Run the Installation Script using the following command.

{% tabs %}
{% tab title="Bash" %}

```bash
./install-pcd.sh `cat version.txt`
```

{% endtab %}
{% endtabs %}

This installs the specific version of `airctl` based on the `version.txt` file.

{% hint style="info" %}
**Note**

It is recommended to run a `airctl status` to ensure all the `desired services` are equal to `ready services` before you begin the upgrade.
{% endhint %}

4. Update `airctl` to the system path.

{% tabs %}
{% tab title="Bash" %}

```bash
sudo cp /opt/pf9/airctl/airctl /usr/bin/
```

{% endtab %}
{% endtabs %}

This ensures you can use `airctl` globally from any location in the terminal.

#### Proxy Configuration (Optional)

If your environment uses a network proxy, update the values `/opt/pf9/airctl/conf/helm_values/kplane.template.yml` again, as the changes would be lost after a new build is installed. Update it again as shown below:

{% tabs %}
{% tab title="Bash" %}

```bash
cat /opt/pf9/airctl/conf/helm_values/kplane.template.yml | grep proxy
# Sample output:
https_proxy: "http://squid.platform9.horse:3128"
http_proxy: "http://squid.platform9.horse:3128"
no_proxy: "10.149.106.11,10.149.106.12,10.149.106.13,10.149.106.14,10.149.106.15,10.149.106.16,127.0.0.1,10.20.0.0/22,localhost,::1,.svc,.svc.cluster.local,10.21.0.0/16,10.20.0.0/16,.cluster.local,.platform9.localnet,.default.svc"
```

{% endtab %}
{% endtabs %}

The list of I.P. addresses in the no\_proxy list should include the master-ips, worker-ips, external-ip4, master-vip4 along with any other addresses for which the traffic should not be routed via proxy server.

#### Step 2: Upgrade all regions

To upgrade **all** regions setup on your Private Cloud Director, execute the following command.

{% tabs %}
{% tab title="Bash" %}

```bash
airctl upgrade --config /opt/pf9/airctl/conf/airctl-config.yaml
```

{% endtab %}
{% endtabs %}

**Optionally**, you can upgrade a specific region, by replacing `<region-name>` with your target region.

{% tabs %}
{% tab title="Bash" %}

```bash
airctl upgrade --region <region-name> --config /opt/pf9/airctl/conf/airctl-config.yaml
```

{% endtab %}
{% endtabs %}

Here is the modified sample command.

{% tabs %}
{% tab title="Bash" %}

```bash
# airctl upgrade --region Region1 --config /opt/pf9/airctl/conf/airctl-config.yaml
 INFO  rollback state directory /tmp/airctl_ddu_backup_Region1_240020739                           
 INFO  Saving the helm revisions to the state file                                        
 INFO  --- backing up region--- Region1                                                             
 INFO  Archive created successfully for Region1. Backup backup.tar.gz saved to /tmp/airctl_ddu_backup_Region1_240020739                                                        
 INFO  --- moving old state file to /tmp/airctl_ddu_backup_Region1_240020739/state.yaml ---        
 INFO  --- moving old kplane_values.yaml file to /tmp/airctl_ddu_backup_Region1_240020739/kplane_values.yaml ---                                     
 SUCCESS  Upgrading region Region1                                                      
upgrade done
```

{% endtab %}
{% endtabs %}

To monitor and diagnose the upgrade logs, add `--verbose`.

Here is the sample command.

{% tabs %}
{% tab title="Bash" %}

```bash
airctl upgrade --config /opt/pf9/airctl/conf/airctl-config.yaml --verbose
```

{% endtab %}
{% endtabs %}

## Verify: Upgrade Success on Management Plane

After completing the upgrade for the management plane, verify if you can continue to access the user interface, then verify if the upgrade was successful by checking the deployment status across all regions.

Run the following command:

{% tabs %}
{% tab title="Bash" %}

```bash
airctl --config /opt/pf9/airctl/conf/airctl-config.yaml status
```

{% endtab %}
{% endtabs %}

Here is the sample output.

{% tabs %}
{% tab title="Example" %}

```bash
------------- deployment details ---------------
fqdn:                airctl-1-3835425-559.platform9.localnet
cluster:             airctl-1-3835425-559-kplane.platform9.localnet
region:              airctl-1-3835425-559
task state:          ready
version:             v-2025.6.0-3833674
-------- region service status ----------
desired services:  29
ready services:    29

------------- deployment details ---------------
fqdn:                airctl-1-3835425-559-sin.platform9.localnet
cluster:             airctl-1-3835425-559-kplane.platform9.localnet
region:              airctl-1-3835425-559-sin
task state:          ready
version:             v-2025.6.0-3833674
-------- region service status ----------
desired services:  75
ready services:    75
```

{% endtab %}
{% endtabs %}

{% hint style="info" %}
**Note**

After a successful upgrade and verification, Private Cloud Director **does not support rollback** to a previous version.
{% endhint %}

## Upgrade the Hosts

After the management plane is successfully upgraded, the hosts running on each of your regions must be updated. The agents running on the host manage communication between hosts and the management plane.

### The Impact from Hosts Upgrade

* No service unavailability is expected during the host upgrade.
* Workloads running on VMs will continue to operate without disruption.

#### Step 1: Upgrade the Hosts

Before you begin the upgrade, execute the following command on each onboarded host to record the current package versions:

{% tabs %}
{% tab title="Bash" %}

```bash
dpkg -l | grep pf9
```

{% endtab %}
{% endtabs %}

Then, to upgrade the hosts in a specific region, execute the following commands:

{% tabs %}
{% tab title="Bash" %}

```bash
export CONSUL_HTTP_ADDR=http://decco-consul-consul-ui.default.svc.cluster.local
export CONSUL_HTTP_TOKEN=$(grep consulToken ${HOME}/.airctl/state.yaml | cut -d' ' -f2)

/opt/pf9/airctl/kpctl -cmd upgrade-hosts -fqdn <region-fqdn>
```

{% endtab %}
{% endtabs %}

This triggers the creation of a `host-upgrade-xxxx` pod in the corresponding region namespace. You can monitor the upgrade progress or verify its success by checking the pod status and logs:

{% tabs %}
{% tab title="Bash" %}

```bash
# List the host upgrade pods
kubectl get pods -n <region-fqdn> | grep host-upgrade

# View logs of the host upgrade pod
kubectl logs -n <region-fqdn> <host-upgrade-pod-name>
```

{% endtab %}
{% endtabs %}

Here is a sample output:

{% tabs %}
{% tab title="Bash" %}

```bash
host-upgrade-1747919688-g5rk5   5/5   Completed   0   83m
kubectl logs -n example-onprem-region1 host-upgrade-1747919688-g5rk5
```

{% endtab %}
{% endtabs %}

If a host fails to upgrade, execute the following command to re-run the upgrade using its **host ID** (found in the pod logs):

{% tabs %}
{% tab title="Bash" %}

```bash
/opt/pf9/airctl/kpctl -cmd upgrade-hosts -fqdn <region-fqdn> -host-ids <host-id>
```

{% endtab %}
{% endtabs %}

#### Step 2: Verify Upgrade Status of the Hosts

After the upgrade, confirm that the host packages have been successfully updated by running the following command again on each host:

{% tabs %}
{% tab title="Bash" %}

```bash
dpkg -l | grep pf9
```

{% endtab %}
{% endtabs %}

Compare the output with the one recorded before the upgrade to ensure the packages were updated as expected.

## Recovery: Upgrade Failure

#### Step 1. Stop the Failed Management Cluster

{% tabs %}
{% tab title="Bash" %}

```bash
airctl stop --config /opt/pf9/airctl/conf/airctl-config.yaml --verbose
```

{% endtab %}
{% endtabs %}

This command shuts down all components of the existing management cluster. `--verbose` helps verify the detailed output of all stopped services.

#### Step 2. Delete the Management Cluster Configuration

{% tabs %}
{% tab title="Bash" %}

```bash
airctl --config /opt/pf9/airctl/conf/airctl-config.yaml unconfigure-du --force --verbose
```

{% endtab %}
{% endtabs %}

This command removes all existing configuration files and metadata associated with the management cluster. Using `--force` enables overriding any locked or incomplete states.

#### Step 3: Delete the Existing Management Cluster

{% tabs %}
{% tab title="Bash" %}

```bash
airctl --config /opt/pf9/airctl/conf/airctl-config.yaml delete-cluster --verbose
```

{% endtab %}
{% endtabs %}

This command permanently deletes the management cluster resources. Ensure that you have backed up all critical data before running this command

#### Step 4. Create a New Management Cluster

{% tabs %}
{% tab title="Bash" %}

```bash
airctl --config /opt/pf9/airctl/conf/airctl-config.yaml create-cluster --verbose
```

{% endtab %}
{% endtabs %}

This command creates a new management cluster with the same configuration as before

#### Step 5. Restore from the Backup

{% tabs %}
{% tab title="Bash" %}

```bash
airctl restore --backupdir <backup-directory> --config /opt/pf9/airctl/conf/airctl-config.yaml --verbose
```

{% endtab %}
{% endtabs %}

Replace `<backup-directory>`with the actual path of your stored backup. This command restores the environment from the backup.
