
# 如何为集群开放命名空间注入？
为集群的命名空间注入sidecar时，若集群未开放命名空间注入，请参考如下指导修改集群配置：
1. 通过kubectl连接集群。
2. 执行**kubectl** **get** **iop** **-nistio-system** ，查询iop资源。
   
   - 若回显如下，表示存在iop资源，请执行[3]。
     ![](https://support.huaweicloud.com/asm_faq/zh-cn_image_0000001270399104.png)
     
   
   - 若回显如下，表示不存在iop资源，请执行[4]。
     ![](https://support.huaweicloud.com/asm_faq/zh-cn_image_0000001321081541.png)
     
   
   
   
   
3. 执行**kubectl** **edit** **iop** **-nistio-system** *data-plane* ，修改autoInject配置项。其中，*data-plane* 为上一步查询的iop资源名称，请替换为实际值。
   
   ```
   global:
         defaultPodDisruptionBudget:
           enabled: true
         hub: *.*.*.*:20202/asm
         logging:
           level: default:info
         meshID: test-payment
         multiCluster:
           clusterName: test-yy
         network: test-yy-network
         proxy:
           autoInject: enabled
         remotePilotAddress: *.*.*.*
         tag: 1.8.6-r1-20220512225026
   ```
   ![](https://support.huaweicloud.com/asm_faq/public_sys-resources/caution_3.0-zh-cn.png)
   istio 1.18.7-r4以及以上的网格版本需要执行下面的操作，istio1.18.7-r4之前的网格版本无需执行。
   在通过kubectl edit iop编辑好您要修改的参数后，需要同时把install.istio.io/ignoreReconcile参数的值改为false，保存退出。
   ![](https://support.huaweicloud.com/asm_faq/zh-cn_image_0000002241895141.png)
   然后再使用kubectl get iop -n istio-system命令查看iop状态，等待STATUS字段变为HEALTHY。
   ![](https://support.huaweicloud.com/asm_faq/zh-cn_image_0000002242015001.png)
   最后还需要再把install.istio.io/ignoreReconcile参数的值改回true。
   
   
4. 执行**kubectl** **edit** **cm** **-nistio-system** **istio-sidecar-injector** ，修改istio-sidecar-injector配置项。
   
   ```
   data:
     config: |-
       policy: enabled
   ```
   
   
 
