Mettre à jour un cluster

Vous pouvez mettre à jour certains paramètres de vos clusters Kubernetes.

Mettre à jour un cluster avec Cockpit

  1. Dans le dashboard Projets, cliquez sur le nom du projet dans lequel vous voulez mettre à jour un cluster.
    Le volet de détails du projet apparaît.

  2. Cliquez sur l’onglet Clusters.
    La liste de vos clusters créés dans le projet apparaît.

  3. Placez le curseur de la souris sur le rang du cluster que vous voulez mettre à jour et cliquez sur le menu IconDotMenu d’actions.
    Un menu déroulant apparaît.

  4. Cliquez sur IconEdit Modifier les paramètres du cluster.
    La boîte de dialogue MODIFIER LES PARAMÈTRES DU CLUSTER apparaît.

  5. Dans le champ IP autorisées, tapez une ou plusieurs IP autorisées à accéder au cluster ou cliquez sur Ajouter mon IP pour ajouter votre IP actuelle.

    Si vous utilisez un VPN, l’IP détectée est celle du VPN. Dans ce cas, tapez manuellement l’IP locale de votre machine.

    Pour supprimer l’accès au cluster, cliquez sur IconClose à côté de l’IP.

  6. (optionnel) Dans le champ Description, tapez une description pour le cluster.

  7. (optionnel) Cochez ou décochez la case Désactiver la suppression par API :

    • Si la case est cochée, vous ne pouvez pas supprimer le projet par API.

    • Si la case est décochée, vous pouvez supprimer le projet par API.

  8. Cliquez sur Modifier.
    Le cluster est mis à jour.

Mettre à jour un cluster avec octl

À ce jour, cette section est disponible en anglais uniquement.

Mettre à jour la configuration d’un cluster

The UpdateCluster command updates the configuration of an existing cluster.

Request sample
$ octl kube api UpdateCluster <cluster_id> --profile "default" \
  --Description "string" \
  --AdmissionFlags.DisableAdmissionPlugins "string" \
  --AdmissionFlags.EnableAdmissionPlugins "string" \
  --Tags.Property1 "string" \
  --Tags.Property2 "string" \
  --AutoMaintenances.MinorUpgradeMaintenance.Enabled=true \
  --AutoMaintenances.MinorUpgradeMaintenance.DurationHours 0 \
  --AutoMaintenances.MinorUpgradeMaintenance.StartHour 12 \
  --AutoMaintenances.MinorUpgradeMaintenance.WeekDay "Mon" \
  --AutoMaintenances.MinorUpgradeMaintenance.Tz "UTC" \
  --AutoMaintenances.PatchUpgradeMaintenance.Enabled=true \
  --AutoMaintenances.PatchUpgradeMaintenance.DurationHours 0 \
  --AutoMaintenances.PatchUpgradeMaintenance.StartHour 12 \
  --AutoMaintenances.PatchUpgradeMaintenance.WeekDay "Mon" \
  --AutoMaintenances.PatchUpgradeMaintenance.Tz "UTC" \
  --MaintenanceWindow.DurationHours 23 \
  --MaintenanceWindow.StartHour 23 \
  --MaintenanceWindow.WeekDay "Mon" \
  --MaintenanceWindow.Tz "UTC" \
  --AdminWhitelist "string" \
  --Quirks "string" \
  --DisableApiTermination=true \
  --Version "string" \
  --ControlPlanes "string" \
  --Auth.Oidc.IssuerUrl "string" \
  --Auth.Oidc.ClientId "string" \
  --Auth.Oidc.UsernameClaim "string" \
  --Auth.Oidc.UsernamePrefix "string" \
  --Auth.Oidc.GroupsClaim "string" \
  --Auth.Oidc.GroupsPrefix "string" \
  --Auth.Oidc.RequiredClaim.Claim "value"

This command contains the following options that you need to specify:

  • AdminWhitelist: (optional) The updated list of CIDR blocks or IPs allowed to access the cluster via the Kubernetes API.

  • AdmissionFlags.DisableAdmissionPlugins: (optional) The list of Kubernetes admission plugins to disable.

  • AdmissionFlags.EnableAdmissionPlugins: (optional) The list of Kubernetes admission plugins to enable.

  • Auth.Oidc.ClientId: The client ID provided by the OIDC provider. This will be used by the cluster to connect to the server.

  • Auth.Oidc.GroupsClaim: (optional) A JSON Web Token (JWT) claim provided by the OIDC provider. This will be used to retrieve the user’s group on the Kubernetes side.

  • Auth.Oidc.GroupsPrefix: (optional) A prefix added to the Kubernetes group, to prevent clashing with existing names (for example, oidc:).

  • Auth.Oidc.IssuerUrl: The server URL of the OIDC provider, using the HTTPS protocol (https://).

  • Auth.Oidc.RequiredClaim: (optional) The key/value combination of OIDC claims that must be included in the ID token for the user to authenticate. If not specified, no claim-based restrictions are enforced.
    Example: {"claim": "value"}.

  • Auth.Oidc.UsernameClaim: (optional) A JSON Web Token (JWT) claim provided by the OIDC provider. This will be used to retrieve the username on the Kubernetes side.

  • Auth.Oidc.UsernamePrefix: (optional) A prefix added to the Kubernetes username, to prevent clashing with existing names (for example, oidc:).

  • AutoMaintenances.MinorUpgradeMaintenance.DurationHours: (optional) The duration of the maintenance window, in hours.
    Minimum value: 0. Maximum value: 23. Default: 0.

  • AutoMaintenances.MinorUpgradeMaintenance.Enabled: (optional) If true, a maintenance window is enabled.
    Default: true.

  • AutoMaintenances.MinorUpgradeMaintenance.StartHour: (optional) The starting time of the maintenance window, in hours.
    Minimum value: 0. Maximum value: 23. Default: 12.

  • AutoMaintenances.MinorUpgradeMaintenance.Tz: (optional) The timezone for the maintenance window.
    Default: UTC.

  • AutoMaintenances.MinorUpgradeMaintenance.WeekDay: (optional) The weekday on which the maintenance window begins.
    Possible values: Mon | Tue | Wed | Thu | Fri | Sat | Sun | string. Default: Tue.

  • AutoMaintenances.PatchUpgradeMaintenance.DurationHours: (optional) The duration of the maintenance window, in hours.
    Minimum value: 0. Maximum value: 23. Default: 0.

  • AutoMaintenances.PatchUpgradeMaintenance.Enabled: (optional) If true, a maintenance window is enabled.
    Default: true.

  • AutoMaintenances.PatchUpgradeMaintenance.StartHour: (optional) The starting time of the maintenance window, in hours.
    Minimum value: 0. Maximum value: 23. Default: 12.

  • AutoMaintenances.PatchUpgradeMaintenance.Tz: (optional) The timezone for the maintenance window.
    Default: UTC.

  • AutoMaintenances.PatchUpgradeMaintenance.WeekDay: (optional) The weekday on which the maintenance window begins.
    Possible values: Mon | Tue | Wed | Thu | Fri | Sat | Sun | string. Default: Tue.

  • ControlPlanes: (optional) The size of the control plane deployment for the cluster.

  • Description: (optional) The updated description of the cluster.

  • DisableApiTermination: (optional) If true, cluster deletion through the API is disabled. If false, it is enabled.

  • MaintenanceWindow.DurationHours: (optional) The duration of the maintenance window, in hours.
    Minimum value: 0. Maximum value: 23. Default: 0.

  • MaintenanceWindow.StartHour: (optional) The starting time of the maintenance window, in hours.
    Minimum value: 0. Maximum value: 23. Default: 12.

  • MaintenanceWindow.Tz: (optional) The timezone for the maintenance window.
    Default: UTC.

  • MaintenanceWindow.WeekDay: (optional) The weekday on which the maintenance window begins.
    Possible values: Mon | Tue | Wed | Thu | Fri | Sat | Sun | string. Default: Tue.

  • Quirks: (optional) The updated list of special configurations or behaviors for the cluster.

  • Tags: (optional) The updated key/value combinations of the tags associated with the cluster’s metadata, in the following format: "tags":{"TAGKEY1":"TAGVALUE1","TAGKEY2":"TAGVALUE2"}.

  • Version: (optional) The updated version of Kubernetes for the cluster. For more information, see GetKubernetesVersions.

The UpdateCluster command returns the following elements:

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the API request.

  • Cluster: Information about the cluster.

    • project_id: The ID of the project this cluster belongs to.

    • id: The Universally Unique Identifier (UUID) of the cluster.

    • name: A unique name for the cluster within the project.

    • description: An optional description of the cluster.
      Default: .

    • cp_multi_az: If true, multi-Subregion deployment is enabled for the control plane. If false, it is disabled.

    • cp_subregions: The Subregions on which the control plane components are deployed.

    • version: The Kubernetes version deployed for the cluster. For more information, see GetKubernetesVersions.

    • expected_version: The version of Kubernetes that is expected to be deployed during maintenance.

    • cni: The Container Network Interface (CNI) used in the cluster.

    • admin_lbu: If true, load balancer administration is enabled for cluster management. If false, it is disabled.

    • admission_flags: The configuration for Kubernetes admission controllers.

      • disable_admission_plugins: The list of Kubernetes admission plugins that are disabled.
        Default: [].

      • enable_admission_plugins: The list of Kubernetes admission plugins that are enabled.
        Default: [].

      • applied_admission_plugins: The list of admission plugins that are currently applied to the cluster.
        Default: ["CertificateApproval", "CertificateSigning", "CertificateSubjectRestriction", "ClusterTrustBundleAttest", "DefaultIngressClass", "DefaultStorageClass", "DefaultTolerationSeconds", "LimitRanger", "MutatingAdmissionWebhook", "NamespaceLifecycle", "PersistentVolumeClaimResize", "PodSecurity", "Priority", "ResourceQuota", "RuntimeClass", "ServiceAccount", "StorageObjectInUseProtection", "TaintNodesByCondition", "ValidatingAdmissionPolicy", "ValidatingAdmissionWebhook"].

    • cidr_pods: The CIDR block of the Kubernetes pods' network.

    • cidr_service: The CIDR block of the Kubernetes services' network.

    • cluster_dns: The IP of the cluster’s DNS service.

    • tags: The key/value combinations of the tags associated with the cluster, in the following format: "tags":{"TAGKEY1":"TAGVALUE1","TAGKEY2":"TAGVALUE2"}.
      Example: {"key": "value"}.

    • auto_maintenances (deprecated): The configuration for automated maintenance windows.

      • minor_upgrade_maintenance: The maintenance window configuration for minor Kubernetes upgrades.

        • enabled: If true, a maintenance window is enabled.
          Default: true.

        • duration_hours: The duration of the maintenance window, in hours.
          Minimum value: 0. Maximum value: 23. Default: 0.

        • start_hour: The starting time of the maintenance window, in hours.
          Minimum value: 0. Maximum value: 23. Default: 12.

        • week_day: The weekday on which the maintenance window begins.
          Possible values: Mon | Tue | Wed | Thu | Fri | Sat | Sun | string. Default: Tue.

        • tz: The timezone for the maintenance window.
          Default: UTC.

      • patch_upgrade_maintenance: The maintenance window configuration for patch Kubernetes upgrades.

        • enabled: If true, a maintenance window is enabled.
          Default: true.

        • duration_hours: The duration of the maintenance window, in hours.
          Minimum value: 0. Maximum value: 23. Default: 0.

        • start_hour: The starting time of the maintenance window, in hours.
          Minimum value: 0. Maximum value: 23. Default: 12.

        • week_day: The weekday on which the maintenance window begins.
          Possible values: Mon | Tue | Wed | Thu | Fri | Sat | Sun | string. Default: Tue.

        • tz: The timezone for the maintenance window.
          Default: UTC.

    • maintenance_window: The configuration for automated maintenance windows.

      • duration_hours: The duration of the maintenance window, in hours.
        Minimum value: 0. Maximum value: 23.

      • start_hour: The starting time of the maintenance window, in hours.
        Minimum value: 0. Maximum value: 23.

      • week_day: The weekday on which the maintenance window begins.
        Possible values: Mon | Tue | Wed | Thu | Fri | Sat | Sun | string.

      • tz: The timezone for the maintenance window.
        Default: UTC.

    • control_planes: The control plane sizing of the cluster.

    • expected_control_planes: The type of control plane size that is expected.

    • admin_whitelist: The list of CIDR blocks or IPs allowed to access the cluster via the Kubernetes API.

    • statuses: The status information of the cluster.

      • created_at: The timestamp when the cluster was created.

      • deleted_at: The timestamp when the cluster was deleted (if applicable).

      • updated_at: The timestamp when the cluster was last updated.

      • status: The status of the cluster.

      • available_upgrade: Any available version of Kubernetes for upgrade (if applicable). For more information, see GetKubernetesVersions.
        Default: .

    • disable_api_termination: If true, cluster deletion through the API is disabled. If false, it is enabled.
      Default: false.

    • auth: The authentication strategy used to access the cluster.

      • oidc: The configuration for authenticating to the cluster using OpenID Connect (OIDC).

        • issuer-url: The server URL of the OIDC provider, using the HTTPS protocol (https://).

        • client-id: The client ID provided by the OIDC provider. This will be used by the cluster to connect to the server.

        • username-claim: A JSON Web Token (JWT) claim provided by the OIDC provider. This will be used to retrieve the username on the Kubernetes side.

        • username-prefix: A prefix added to the Kubernetes username, to prevent clashing with existing names (for example, oidc:).

        • groups-claim: A JSON Web Token (JWT) claim provided by the OIDC provider. This will be used to retrieve the user’s group on the Kubernetes side.

        • groups-prefix: A prefix added to the Kubernetes group, to prevent clashing with existing names (for example, oidc:).

        • required-claim: The key/value combination of OIDC claims that must be included in the ID token for the user to authenticate. If not specified, no claim-based restrictions are enforced.
          Example: {"claim": "value"}.

Result sample
{
  "ResponseContext": {
    "RequestId": "string"
  },
  "Cluster": {
    "project_id": "string",
    "id": "string",
    "name": "string",
    "description": "",
    "cp_multi_az": true,
    "cp_subregions": [
      "string"
    ],
    "version": "string",
    "expected_version": "string",
    "cni": "string",
    "admin_lbu": true,
    "admission_flags": {
      "disable_admission_plugins": [],
      "enable_admission_plugins": [],
      "applied_admission_plugins": [
        "CertificateApproval",
        "CertificateSigning",
        "CertificateSubjectRestriction",
        "ClusterTrustBundleAttest",
        "DefaultIngressClass",
        "DefaultStorageClass",
        "DefaultTolerationSeconds",
        "LimitRanger",
        "MutatingAdmissionWebhook",
        "NamespaceLifecycle",
        "PersistentVolumeClaimResize",
        "PodSecurity",
        "Priority",
        "ResourceQuota",
        "RuntimeClass",
        "ServiceAccount",
        "StorageObjectInUseProtection",
        "TaintNodesByCondition",
        "ValidatingAdmissionPolicy",
        "ValidatingAdmissionWebhook"
      ]
    },
    "cidr_pods": "string",
    "cidr_service": "string",
    "cluster_dns": "string",
    "tags": {
      "key": "value"
    },
    "auto_maintenances": {
      "minor_upgrade_maintenance": {
        "enabled": true,
        "duration_hours": 0,
        "start_hour": 12,
        "week_day": "Mon",
        "tz": "UTC"
      },
      "patch_upgrade_maintenance": {
        "enabled": true,
        "duration_hours": 0,
        "start_hour": 12,
        "week_day": "Mon",
        "tz": "UTC"
      }
    },
    "maintenance_window": {
      "duration_hours": 23,
      "start_hour": 23,
      "week_day": "Mon",
      "tz": "UTC"
    },
    "control_planes": "string",
    "expected_control_planes": "string",
    "admin_whitelist": [
      "string"
    ],
    "statuses": {
      "created_at": "2019-08-24T14:15:22Z",
      "deleted_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z",
      "status": "string",
      "available_upgrade": ""
    },
    "disable_api_termination": false,
    "auth": {
      "oidc": {
        "issuer-url": "string",
        "client-id": "string",
        "username-claim": "string",
        "username-prefix": "string",
        "groups-claim": [
          "string"
        ],
        "groups-prefix": "string",
        "required-claim": {
          "claim": "value"
        }
      }
    }
  }
}

Mettre à jour la version de Kubernetes d’un cluster

The UpgradeCluster command upgrades a specific cluster to the latest available version of Kubernetes. For more information, see GetKubernetesVersions.

Request sample
$ octl kube api UpgradeCluster <cluster_id> --profile "default"

The UpgradeCluster command returns the following elements:

  • ResponseContext: Information about the context of the response.

    • RequestId: The ID of the API request.

  • Cluster: Information about the cluster.

    • project_id: The ID of the project this cluster belongs to.

    • id: The Universally Unique Identifier (UUID) of the cluster.

    • name: A unique name for the cluster within the project.

    • description: An optional description of the cluster.
      Default: .

    • cp_multi_az: If true, multi-Subregion deployment is enabled for the control plane. If false, it is disabled.

    • cp_subregions: The Subregions on which the control plane components are deployed.

    • version: The Kubernetes version deployed for the cluster. For more information, see GetKubernetesVersions.

    • expected_version: The version of Kubernetes that is expected to be deployed during maintenance.

    • cni: The Container Network Interface (CNI) used in the cluster.

    • admin_lbu: If true, load balancer administration is enabled for cluster management. If false, it is disabled.

    • admission_flags: The configuration for Kubernetes admission controllers.

      • disable_admission_plugins: The list of Kubernetes admission plugins that are disabled.
        Default: [].

      • enable_admission_plugins: The list of Kubernetes admission plugins that are enabled.
        Default: [].

      • applied_admission_plugins: The list of admission plugins that are currently applied to the cluster.
        Default: ["CertificateApproval", "CertificateSigning", "CertificateSubjectRestriction", "ClusterTrustBundleAttest", "DefaultIngressClass", "DefaultStorageClass", "DefaultTolerationSeconds", "LimitRanger", "MutatingAdmissionWebhook", "NamespaceLifecycle", "PersistentVolumeClaimResize", "PodSecurity", "Priority", "ResourceQuota", "RuntimeClass", "ServiceAccount", "StorageObjectInUseProtection", "TaintNodesByCondition", "ValidatingAdmissionPolicy", "ValidatingAdmissionWebhook"].

    • cidr_pods: The CIDR block of the Kubernetes pods' network.

    • cidr_service: The CIDR block of the Kubernetes services' network.

    • cluster_dns: The IP of the cluster’s DNS service.

    • tags: The key/value combinations of the tags associated with the cluster, in the following format: "tags":{"TAGKEY1":"TAGVALUE1","TAGKEY2":"TAGVALUE2"}.
      Example: {"key": "value"}.

    • auto_maintenances (deprecated): The configuration for automated maintenance windows.

      • minor_upgrade_maintenance: The maintenance window configuration for minor Kubernetes upgrades.

        • enabled: If true, a maintenance window is enabled.
          Default: true.

        • duration_hours: The duration of the maintenance window, in hours.
          Minimum value: 0. Maximum value: 23. Default: 0.

        • start_hour: The starting time of the maintenance window, in hours.
          Minimum value: 0. Maximum value: 23. Default: 12.

        • week_day: The weekday on which the maintenance window begins.
          Possible values: Mon | Tue | Wed | Thu | Fri | Sat | Sun | string. Default: Tue.

        • tz: The timezone for the maintenance window.
          Default: UTC.

      • patch_upgrade_maintenance: The maintenance window configuration for patch Kubernetes upgrades.

        • enabled: If true, a maintenance window is enabled.
          Default: true.

        • duration_hours: The duration of the maintenance window, in hours.
          Minimum value: 0. Maximum value: 23. Default: 0.

        • start_hour: The starting time of the maintenance window, in hours.
          Minimum value: 0. Maximum value: 23. Default: 12.

        • week_day: The weekday on which the maintenance window begins.
          Possible values: Mon | Tue | Wed | Thu | Fri | Sat | Sun | string. Default: Tue.

        • tz: The timezone for the maintenance window.
          Default: UTC.

    • maintenance_window: The configuration for automated maintenance windows.

      • duration_hours: The duration of the maintenance window, in hours.
        Minimum value: 0. Maximum value: 23.

      • start_hour: The starting time of the maintenance window, in hours.
        Minimum value: 0. Maximum value: 23.

      • week_day: The weekday on which the maintenance window begins.
        Possible values: Mon | Tue | Wed | Thu | Fri | Sat | Sun | string.

      • tz: The timezone for the maintenance window.
        Default: UTC.

    • control_planes: The control plane sizing of the cluster.

    • expected_control_planes: The type of control plane size that is expected.

    • admin_whitelist: The list of CIDR blocks or IPs allowed to access the cluster via the Kubernetes API.

    • statuses: The status information of the cluster.

      • created_at: The timestamp when the cluster was created.

      • deleted_at: The timestamp when the cluster was deleted (if applicable).

      • updated_at: The timestamp when the cluster was last updated.

      • status: The status of the cluster.

      • available_upgrade: Any available version of Kubernetes for upgrade (if applicable). For more information, see GetKubernetesVersions.
        Default: .

    • disable_api_termination: If true, cluster deletion through the API is disabled. If false, it is enabled.
      Default: false.

    • auth: The authentication strategy used to access the cluster.

      • oidc: The configuration for authenticating to the cluster using OpenID Connect (OIDC).

        • issuer-url: The server URL of the OIDC provider, using the HTTPS protocol (https://).

        • client-id: The client ID provided by the OIDC provider. This will be used by the cluster to connect to the server.

        • username-claim: A JSON Web Token (JWT) claim provided by the OIDC provider. This will be used to retrieve the username on the Kubernetes side.

        • username-prefix: A prefix added to the Kubernetes username, to prevent clashing with existing names (for example, oidc:).

        • groups-claim: A JSON Web Token (JWT) claim provided by the OIDC provider. This will be used to retrieve the user’s group on the Kubernetes side.

        • groups-prefix: A prefix added to the Kubernetes group, to prevent clashing with existing names (for example, oidc:).

        • required-claim: The key/value combination of OIDC claims that must be included in the ID token for the user to authenticate. If not specified, no claim-based restrictions are enforced.
          Example: {"claim": "value"}.

Result sample
{
  "ResponseContext": {
    "RequestId": "string"
  },
  "Cluster": {
    "project_id": "string",
    "id": "string",
    "name": "string",
    "description": "",
    "cp_multi_az": true,
    "cp_subregions": [
      "string"
    ],
    "version": "string",
    "expected_version": "string",
    "cni": "string",
    "admin_lbu": true,
    "admission_flags": {
      "disable_admission_plugins": [],
      "enable_admission_plugins": [],
      "applied_admission_plugins": [
        "CertificateApproval",
        "CertificateSigning",
        "CertificateSubjectRestriction",
        "ClusterTrustBundleAttest",
        "DefaultIngressClass",
        "DefaultStorageClass",
        "DefaultTolerationSeconds",
        "LimitRanger",
        "MutatingAdmissionWebhook",
        "NamespaceLifecycle",
        "PersistentVolumeClaimResize",
        "PodSecurity",
        "Priority",
        "ResourceQuota",
        "RuntimeClass",
        "ServiceAccount",
        "StorageObjectInUseProtection",
        "TaintNodesByCondition",
        "ValidatingAdmissionPolicy",
        "ValidatingAdmissionWebhook"
      ]
    },
    "cidr_pods": "string",
    "cidr_service": "string",
    "cluster_dns": "string",
    "tags": {
      "key": "value"
    },
    "auto_maintenances": {
      "minor_upgrade_maintenance": {
        "enabled": true,
        "duration_hours": 0,
        "start_hour": 12,
        "week_day": "Mon",
        "tz": "UTC"
      },
      "patch_upgrade_maintenance": {
        "enabled": true,
        "duration_hours": 0,
        "start_hour": 12,
        "week_day": "Mon",
        "tz": "UTC"
      }
    },
    "maintenance_window": {
      "duration_hours": 23,
      "start_hour": 23,
      "week_day": "Mon",
      "tz": "UTC"
    },
    "control_planes": "string",
    "expected_control_planes": "string",
    "admin_whitelist": [
      "string"
    ],
    "statuses": {
      "created_at": "2019-08-24T14:15:22Z",
      "deleted_at": "2019-08-24T14:15:22Z",
      "updated_at": "2019-08-24T14:15:22Z",
      "status": "string",
      "available_upgrade": ""
    },
    "disable_api_termination": false,
    "auth": {
      "oidc": {
        "issuer-url": "string",
        "client-id": "string",
        "username-claim": "string",
        "username-prefix": "string",
        "groups-claim": [
          "string"
        ],
        "groups-prefix": "string",
        "required-claim": {
          "claim": "value"
        }
      }
    }
  }
}

Mettre à jour un cluster avec OKS CLI

Vous ne pouvez pas mettre à jour les paramètres parenting project et profile du cluster.

Pour mettre à jour les paramètres de l’un de vos clusters, utilisez la commande cluster update en suivant cette syntaxe :

Exemple de requête
$ oks-cli cluster update \
  --project-name NAME_OF_PROJECT \
  --cluster-name NAME_OF_CLUSTER \
  --description "DESCRIPTION_OF_CLUSTER" \
  --admin "1.2.3.4/32" \
  --version KUBERNETES_VERSION

Lors d’une mise à jour de cluster, vous pouvez annuler l’opération et revenir à la version précédente tant que la mise à jour n’est pas encore terminée. Pour ce faire, définissez l’ancienne version comme version cible.

Cette commande contient les options suivantes que vous devez spécifier :

  • cluster-name : Le nom du cluster que vous voulez mettre à jour.

  • (optionnel) admin : Les IP à mettre sur liste blanche, en notation CIDR et séparées par des virgules. Cette plage d’une ou plusieurs IP est vide par défaut, et doit être spécifiée pour pouvoir gérer le cluster après sa création.

  • (optionnel) control-plane : La taille souhaitée du control plane. Pour en savoir plus, voir Control planes.

  • (optionnel) description : La description mise à jour du cluster.

  • (optionnel) disable-admission-plugins : La liste des plugins d’admission de la liste par défaut que vous souhaitez désactiver.

  • (optionnel) disable-api-termination : La possibilité de supprimer le cluster via l’API. Si true, la suppression du cluster est désactivée. Si false, elle est activée.

  • (optionnel) enable-admission-plugins : La liste des plugins d’admission supplémentaires que vous souhaitez activer sur le cluster. Pour en savoir plus sur les plugins d’admission, voir la documentation Kubernetes (anglais uniquement).

  • (optionnel) filename : Le nom du fichier manifeste à partir duquel vous souhaitez mettre à jour le cluster. S’il est spécifié, les paramètres de mise à jour sont lus à partir du fichier manifeste au lieu d’être fournis individuellement dans la commande. Pour en savoir plus, voir Mettre à jour un cluster avec un manifeste.

  • (optionnel) output : Le format de sortie de la réponse (json | yaml). Par défaut, le format de la réponse est JSON.

  • (optionnel) project-name : Le nom du projet contenant le cluster.

  • (optionnel) quirk : Les clés et les paramètres à transmettre au cluster. Cette option est requise pour les demandes de fonctionnalités.

  • (optionnel) tags : Les tags que vous voulez ajouter aux nœuds du cluster.

  • (optionnel) version : La version de Kubernetes à utiliser pour le cluster. Pour en savoir plus à propos des versions prises en charge, voir À propos d’OKS > Versions Kubernetes prises en charge. Le dernier correctif pour la version spécifiée est utilisé automatiquement.

La commande cluster update renvoie les éléments suivants :

  • project_id : L’identifiant unique du projet dans lequel se trouve le cluster que vous avez mis à jour.

  • id : L’identifiant unique du cluster que vous avez mis à jour.

  • name : Le nom du cluster que vous avez mis à jour.

  • description : La description mise à jour du cluster.

Exemple de résultat
{
  "project_id": "2f4gc161-7b4c-4464-8f45-4f6daf4a09c8",
  "id": "bcd8c536-36f4-422c-838f-189c23dd6253",
  "name": "NAME_OF_CLUSTER",
  "description": "DESCRIPTION_OF_CLUSTER"
}

Mettre à jour la version de Kubernetes

Pour mettre à jour la version Kubernetes du cluster, vous devez d’abord exécuter la commande cluster update, puis appliquer la mise à jour au control plane du cluster.

  1. Utilisez la commande cluster upgrade pour mettre à jour le control plane du cluster :

    Exemple de requête
    $ oks-cli cluster upgrade  \
        --output json

    Cette commande contient les options suivantes que vous devez spécifier :

    • cluster-name : Le nom du cluster.

    • (optionnel) project-name : Le nom du projet contenant le cluster.

    • (optionnel) output : Le format de sortie de la réponse (json | yaml). Par défaut, le format de la réponse est JSON.

  2. Renouvelez les node pools pour mettre à jour les worker nodes du cluster.

Pour en savoir plus sur le processus de mise à niveau, voir Tutoriel : Mettre à niveau la version Kubernetes d’un cluster.

Redimensionner un control plane

  • Le redimensionnement peut entraîner un redémarrage temporaire du serveur API.

  • Il n’est pas possible de passer d’un type de control plane de taille supérieure à cp.mono.master. Pour en savoir plus sur les types de control planes, voir À propos d’OKS > Control Planes.

  1. Exécutez la commande cluster update pour définir le nouveau dimensionnement du control plane :

    Exemple de requête
    $ oks-cli cluster update \
      --project-name NAME_OF_PROJECT \
      --cluster-name NAME_OF_CLUSTER \
      --control-plane cp.3.masters.small

    Vous pouvez consulter l’état de la mise à jour à l’aide de la commande cluster get :

    Exemple de requête
    $ oks-cli cluster get \
        --cluster-name NAME_OF_CLUSTER

    Après une mise à jour réussie, la commande renvoie l’élément expected_control_planes avec le dimensionnement souhaité.

  2. Utilisez la commande cluster upgrade pour appliquer les modifications au control plane :

    Exemple de requête
    $ oks-cli cluster upgrade \
        --cluster-name NAME_OF_CLUSTER

    Cette commande contient les options suivantes que vous devez spécifier :

    • cluster-name : Le nom du cluster.

    • (optionnel) project-name : Le nom du projet contenant le cluster.

    • (optionnel) output : Le format de sortie de la réponse (json | yaml). Par défaut, le format de la réponse est JSON.

La mise à niveau peut prendre quelques minutes.

Vous pouvez vérifier le redimensionnement du control plane à l’aide de la commande cluster list. Pour en savoir plus, voir Lister vos clusters.

Mettre à jour un cluster avec un manifeste

Si vous avez créé votre cluster à l’aide d’un fichier manifeste, vous pouvez le mettre à jour en modifiant ce fichier et en le spécifiant à l’aide de l’option filename.

  1. Modifiez les paramètres que vous souhaitez mettre à jour.

    Exemple de manifeste
    name: NAME_OF_CLUSTER
    description: DESCRIPTION_OF_CLUSTER
    version: VERSION_NUMBER
    control_planes: cp.3.masters.small
    admin_whitelist:
      - 1.2.3.4/32
      - 5.6.7.8/32
    disable_api_termination: false
    tags:
      tag1: this
      tag2: that
  2. Enregistrez le fichier manifeste.

  3. Mettez à jour le cluster à l’aide du manifeste modifié :

    $ oks-cli cluster update \
      --project-name NAME_OF_PROJECT \
      --cluster-name NAME_OF_CLUSTER \
      --filename ~/PATH/NAME_OF_CLUSTER_FILE.yaml

    Cette commande contient les options suivantes que vous devez spécifier :

    • (optionnel) project-name : Le nom du projet contenant le cluster.

    • cluster-name : Le nom du cluster que vous souhaitez mettre à jour.

    • filename : Le nom du fichier de manifeste modifié.

Pages connexes

Méthodes API correspondantes