赞
踩
在kubernetes集群中安装istio之后,在创建的depoyment中已经使用了注入注解sidecar.istio.io/inject: 'true’配置,但是istio pod不创建,代码示例如下
kind: Deployment apiVersion: apps/v1 metadata: name: name-a namespace: namespace-a labels: app: xxxx app.kubernetes.io/name: xxx app.kubernetes.io/version: v1 version: v1 annotations: deployment.kubernetes.io/revision: '5' servicemesh.kubesphere.io/enabled: 'true' spec: replicas: 1 selector: matchLabels: app: xxxx app.kubernetes.io/name: xxx app.kubernetes.io/version: v1 version: v1 template: metadata: creationTimestamp: null labels: app: xxxx app.kubernetes.io/name: xxx app.kubernetes.io/version: v1 version: v1 annotations: cni.projectcalico.org/ipv4pools: '["default-ipv4-ippool"]' kubesphere.io/restartedAt: '2024-03-01T05:44:45.617Z' sidecar.istio.io/inject: 'true' spec: containers: - name: xxx-v1 image: image-a:0.0.1 ports: - name: http-8080 containerPort: 8080 protocol: TCP resources: limits: cpu: '2' memory: 4Gi nvidia.com/gpu: '0' requests: nvidia.com/gpu: '0' terminationMessagePath: /dev/termination-log terminationMessagePolicy: File imagePullPolicy: Always restartPolicy: Always terminationGracePeriodSeconds: 30 dnsPolicy: ClusterFirst serviceAccountName: default serviceAccount: default securityContext: {} imagePullSecrets: - name: harbor-secret schedulerName: default-scheduler strategy: type: RollingUpdate rollingUpdate: maxUnavailable: 25% maxSurge: 25% revisionHistoryLimit: 10 progressDeadlineSeconds: 600
经排查对命名空间namespace-a需要设置注解属性为enabled.
查看命令
kubectl get namespace -L istio-injection
查看各个命名空间是否镜像istio-injection注解的设置。
使用一下命令对命名空间属性进行配置
kubectl label namespace namespace-a istio-injection=enabled
部分参考 https://cloud.tencent.com/document/product/1261/62949
经过以上修改后,istio pod可以自动创建起来,但是访问报错 RBAC: access denied。
这里要查看授权策略,授权策略用于配置网格、namespace、服务/Workload 范围的访问管理规则。您可以通过 AuthorizationPolicy CRD 配置授权规则。AuthorizationPolicy 主要包含以下部分:
当有 AuthorizationPolicy 的 ALLOW 和 DENY 策略应用于同一范围时,DNEY 策略的优先级高于 ALLOW 策略,生效的规则如下:
问题解决。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。