Este conteúdo foi traduzido por máquina para sua conveniência e a Huawei Cloud não pode garantir que o conteúdo foi traduzido com precisão. Para exibir o conteúdo original, use o link no canto superior direito para mudar para a página em inglês.
Central de ajuda/ Host Security Service/ Perguntas frequentes/ Container Guard Service/ O que devo fazer se o plug-in de proteção de cluster de container falhar ao ser desinstalado?
Atualizado em 2024-01-04 GMT+08:00

O que devo fazer se o plug-in de proteção de cluster de container falhar ao ser desinstalado?

Possíveis causas

Se a rede do cluster estiver anormal ou o plug-in estiver em execução, a desinstalação do plug-in no console do HSS poderá falhar.

Solução

Execute as seguintes etapas para desinstalar manualmente o plug-in:

  1. Faça logon no servidor de nuvem.
  2. Crie o arquivo plugin.yaml no diretório /tmp e copie o seguinte conteúdo do script para o arquivo:

    apiVersion: v1
    kind: Namespace
    metadata:
      labels:
        admission.gatekeeper.sh/ignore: no-self-managing
        control-plane: controller-manager
        gatekeeper.sh/system: "yes"
        pod-security.kubernetes.io/audit: restricted
        pod-security.kubernetes.io/audit-version: latest
        pod-security.kubernetes.io/enforce: restricted
        pod-security.kubernetes.io/enforce-version: v1.24
        pod-security.kubernetes.io/warn: restricted
        pod-security.kubernetes.io/warn-version: latest
      name: gatekeeper-system
    ---
    apiVersion: apiextensions.k8s.io/v1
    kind: CustomResourceDefinition
    metadata:
      annotations:
        controller-gen.kubebuilder.io/version: v0.10.0
      labels:
        gatekeeper.sh/system: "yes"
      name: assign.mutations.gatekeeper.sh
    ---
    apiVersion: apiextensions.k8s.io/v1
    kind: CustomResourceDefinition
    metadata:
      annotations:
        controller-gen.kubebuilder.io/version: v0.10.0
      labels:
        gatekeeper.sh/system: "yes"
      name: assignimage.mutations.gatekeeper.sh
    ---
    apiVersion: apiextensions.k8s.io/v1
    kind: CustomResourceDefinition
    metadata:
      annotations:
        controller-gen.kubebuilder.io/version: v0.10.0
      labels:
        gatekeeper.sh/system: "yes"
      name: assignmetadata.mutations.gatekeeper.sh
    ---
    apiVersion: apiextensions.k8s.io/v1
    kind: CustomResourceDefinition
    metadata:
      annotations:
        controller-gen.kubebuilder.io/version: v0.10.0
      labels:
        gatekeeper.sh/system: "yes"
      name: configs.config.gatekeeper.sh
    ---
    apiVersion: apiextensions.k8s.io/v1
    kind: CustomResourceDefinition
    metadata:
      annotations:
        controller-gen.kubebuilder.io/version: v0.10.0
      labels:
        gatekeeper.sh/system: "yes"
      name: constraintpodstatuses.status.gatekeeper.sh
    ---
    apiVersion: apiextensions.k8s.io/v1
    kind: CustomResourceDefinition
    metadata:
      annotations:
        controller-gen.kubebuilder.io/version: v0.10.0
      labels:
        gatekeeper.sh/system: "yes"
      name: constrainttemplatepodstatuses.status.gatekeeper.sh
    ---
    apiVersion: apiextensions.k8s.io/v1
    kind: CustomResourceDefinition
    metadata:
      annotations:
        controller-gen.kubebuilder.io/version: v0.11.3
      labels:
        gatekeeper.sh/system: "yes"
      name: constrainttemplates.templates.gatekeeper.sh
    ---
    apiVersion: apiextensions.k8s.io/v1
    kind: CustomResourceDefinition
    metadata:
      annotations:
        controller-gen.kubebuilder.io/version: v0.10.0
      labels:
        gatekeeper.sh/system: "yes"
      name: expansiontemplate.expansion.gatekeeper.sh
    ---
    apiVersion: apiextensions.k8s.io/v1
    kind: CustomResourceDefinition
    metadata:
      annotations:
        controller-gen.kubebuilder.io/version: v0.10.0
      labels:
        gatekeeper.sh/system: "yes"
      name: expansiontemplatepodstatuses.status.gatekeeper.sh
    ---
    apiVersion: apiextensions.k8s.io/v1
    kind: CustomResourceDefinition
    metadata:
      annotations:
        controller-gen.kubebuilder.io/version: v0.10.0
      labels:
        gatekeeper.sh/system: "yes"
      name: modifyset.mutations.gatekeeper.sh
    ---
    apiVersion: apiextensions.k8s.io/v1
    kind: CustomResourceDefinition
    metadata:
      annotations:
        controller-gen.kubebuilder.io/version: v0.10.0
      labels:
        gatekeeper.sh/system: "yes"
      name: mutatorpodstatuses.status.gatekeeper.sh
    ---
    apiVersion: apiextensions.k8s.io/v1
    kind: CustomResourceDefinition
    metadata:
      annotations:
        controller-gen.kubebuilder.io/version: v0.11.3
      labels:
        gatekeeper.sh/system: "yes"
      name: providers.externaldata.gatekeeper.sh
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: Role
    metadata:
      creationTimestamp: null
      labels:
        gatekeeper.sh/system: "yes"
      name: gatekeeper-manager-role
      namespace: gatekeeper-system
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRole
    metadata:
      creationTimestamp: null
      labels:
        gatekeeper.sh/system: "yes"
      name: gatekeeper-manager-role
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: RoleBinding
    metadata:
      labels:
        gatekeeper.sh/system: "yes"
      name: gatekeeper-manager-rolebinding
      namespace: gatekeeper-system
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: Role
      name: gatekeeper-manager-role
    subjects:
    - kind: ServiceAccount
      name: gatekeeper-admin
      namespace: gatekeeper-system
    ---
    apiVersion: rbac.authorization.k8s.io/v1
    kind: ClusterRoleBinding
    metadata:
      labels:
        gatekeeper.sh/system: "yes"
      name: gatekeeper-manager-rolebinding
    roleRef:
      apiGroup: rbac.authorization.k8s.io
      kind: ClusterRole
      name: gatekeeper-manager-role
    subjects:
    - kind: ServiceAccount
      name: gatekeeper-admin
      namespace: gatekeeper-system
    ---
    apiVersion: admissionregistration.k8s.io/v1
    kind: MutatingWebhookConfiguration
    metadata:
      labels:
        gatekeeper.sh/system: "yes"
      name: gatekeeper-mutating-webhook-configuration
    ---
    apiVersion: admissionregistration.k8s.io/v1
    kind: ValidatingWebhookConfiguration
    metadata:
      labels:
        gatekeeper.sh/system: "yes"
      name: gatekeeper-validating-webhook-configuration

  1. Crie o arquivo uninstall.sh no diretório /tmp e copie o seguinte conteúdo de script para o arquivo:

    #!/bin/bash
    kubectl delete -f /tmp/plugin.yaml
    kubectl delete ns cgs-provider

  2. Execute o seguinte comando para desinstalar o plug-in de proteção de cluster de container:

    bash /tmp/uninstall.sh

    Se forem exibidas informações semelhantes às seguintes, o plug-in foi desinstalado.