> ## Documentation Index
> Fetch the complete documentation index at: https://cloudanix.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# K8s control plane redundancy remediation

### Triage and Remediation

<Tabs>
  <Tab title="Remediation">
    ### Remediation

    <AccordionGroup>
      <Accordion title="Using Console" defaultOpen="true">
        To enable regional redundancy for maximum availability in GCP, follow these step-by-step instructions:

        1. Open the GCP Console and select the project where you want to enable regional redundancy.

        2. Go to the Cloud Storage section of the console.

        3. Select the bucket for which you want to enable regional redundancy.

        4. Click on the "Edit bucket" button at the top of the page.

        5. Scroll down to the "Location" section of the page.

        6. Select "Regional" from the dropdown menu.

        7. Choose the region where you want to store your data.

        8. Click on the "Save" button at the bottom of the page.

        9. Wait for the changes to take effect. This may take some time depending on the amount of data you have stored in your bucket.

        Once you have completed these steps, your bucket will be configured for regional redundancy, which means that your data will be stored in multiple locations within the same region for maximum availability.

        #
      </Accordion>

      <Accordion title="Using CLI">
        To enable regional redundancy for maximum availability in GCP, follow these steps using GCP CLI:

        1. Open the Google Cloud Console and select the project that contains the resources you want to configure.

        2. Open the Cloud Shell by clicking on the "Activate Cloud Shell" button on the top right corner of the console.

        3. Run the following command to enable regional redundancy for Cloud Storage:

           ```
           gsutil versioning set on gs://[BUCKET_NAME]
           ```

           Replace \[BUCKET\_NAME] with the name of the bucket you want to enable regional redundancy for.

        4. Run the following command to enable regional redundancy for Cloud SQL:

           ```
           gcloud sql instances patch [INSTANCE_NAME] --availability-type REGIONAL
           ```

           Replace \[INSTANCE\_NAME] with the name of the Cloud SQL instance you want to enable regional redundancy for.

        5. Run the following command to enable regional redundancy for Compute Engine:

           ```
           gcloud compute instances create [INSTANCE_NAME] --zone [ZONE] --create-disk=auto-delete=yes,boot=yes,mode=rw,name=[DISK_NAME],replica-zones=[ZONE_1],[ZONE_2],type=pd-ssd
           ```

           Replace \[INSTANCE\_NAME] with the name of the Compute Engine instance you want to enable regional redundancy for. Replace \[ZONE] with the primary zone for the instance. Replace \[DISK\_NAME] with the name of the boot disk for the instance. Replace \[ZONE\_1] and \[ZONE\_2] with the two additional zones you want to replicate the instance to.

        By following these steps, you can enable regional redundancy for maximum availability in GCP.
      </Accordion>

      <Accordion title="Using Python">
        To enable regional redundancy for maximum availability in GCP using Python, you can follow these steps:

        1. Import the necessary libraries:

        ```
        from google.cloud import storage
        ```

        2. Create a client object for the storage bucket:

        ```
        client = storage.Client()
        ```

        3. Get the bucket object:

        ```
        bucket = client.get_bucket('your-bucket-name')
        ```

        4. Set the location type to regional:

        ```
        bucket.location_type = 'regional'
        ```

        5. Set the location to the desired region:

        ```
        bucket.location = 'your-region'
        ```

        6. Update the bucket:

        ```
        bucket.update()
        ```

        7. Confirm that the bucket is now using regional redundancy by checking the bucket's location type:

        ```
        print(bucket.location_type)
        ```

        This should output "REGIONAL", indicating that the bucket is now using regional redundancy.

        Note: Replace "your-bucket-name" and "your-region" with the actual name of your bucket and the desired region, respectively.
      </Accordion>

      <Accordion title="Using Terraform">
        ```hcl theme={null}
        resource "google_container_cluster" "PRIMARY_CLUSTER" {
          name     = "PRIMARY_CLUSTER_NAME"   # replace with your cluster name
          location = "us-central1"            # replace with your desired REGION (not a zone)

          # Optional: explicitly choose zones within the region for the nodes
          node_locations = [
            "us-central1-a",
            "us-central1-b",
            "us-central1-c",
          ]

          remove_default_node_pool = true
          initial_node_count       = 1

          # ...other cluster settings...
        }

        resource "google_container_node_pool" "PRIMARY_NODE_POOL" {
          name       = "PRIMARY_NODE_POOL_NAME"   # replace with your node pool name
          cluster    = google_container_cluster.PRIMARY_CLUSTER.name
          location   = google_container_cluster.PRIMARY_CLUSTER.location

          node_count = 3

          node_config {
            machine_type = "e2-standard-4"
            # ...other node config...
          }
        }
        ```

        Changing a GKE cluster from zonal to regional is not an in‑place update; Terraform will destroy the existing `google_container_cluster` and create a new regional one, causing control plane and node replacement and requiring workloads to be redeployed or migrated.

        For verification, `terraform plan` should show the old zonal `google_container_cluster` marked with `-/+` (destroy and recreate) or `-` (destroy) and the new one with `+` (create), with `location` changing from a zone (for example, `us-central1-a`) to a region (for example, `us-central1`).
      </Accordion>
    </AccordionGroup>
  </Tab>
</Tabs>
