مشاركة عبر


استكشاف أخطاء الوظيفة الإضافية Open Service Mesh (OSM) لخدمة Azure Kubernetes (AKS) وإصلاحها

عند نشر الوظيفة الإضافية Open Service Mesh (OSM) لخدمة Azure Kubernetes (AKS)، قد تواجه مشكلات مرتبطة بتكوين شبكة الخدمة. تستكشف المقالة أخطاء استكشاف الأخطاء وإصلاحها الشائعة وكيفية حلها.

إشعار

مع إيقاف شبكة الخدمة المفتوحة (OSM) من قبل Cloud Native Computing Foundation (CNCF)، نوصي بتحديد تكوينات OSM الخاصة بك وترحيلها إلى تكوين Istio مكافئ. للحصول على معلومات حول الترحيل من OSM إلى Istio، راجع إرشادات الترحيل لتكوينات شبكة الخدمة المفتوحة (OSM) إلى Istio.

التحقق من مكونات OSM واستكشاف الأخطاء وإصلاحها

تحقق من توزيع وحدة تحكم OSM والجراب والخدمة

  • تحقق من توزيع وحدة تحكم OSM، والجراب، وصحة kubectl get deployment,pod,service الخدمة باستخدام الأمر .

    kubectl get deployment,pod,service -n kube-system --selector app=osm-controller
    

    تعطي وحدة تحكم OSM السليمة إخراجا مشابها لإخراج المثال التالي:

    NAME                             READY   UP-TO-DATE   AVAILABLE   AGE
    deployment.apps/osm-controller   2/2     2            2           3m4s
    
    NAME                                  READY   STATUS    RESTARTS   AGE
    pod/osm-controller-65bd8c445c-zszp4   1/1     Running   0          2m
    pod/osm-controller-65bd8c445c-xqhmk   1/1     Running   0          16s
    
    NAME                     TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)                       AGE
    service/osm-controller   ClusterIP   10.96.185.178   <none>        15128/TCP,9092/TCP,9091/TCP   3m4s
    service/osm-validator    ClusterIP   10.96.11.78     <none>        9093/TCP                      3m4s
    

    إشعار

    osm-controller بالنسبة للخدمات، يختلف CLUSTER-IP. يجب أن يكون اسم الخدمة وPORT(S) هو نفس إخراج المثال.

تحقق من توزيع OSM Injector والجراب والخدمة

  • تحقق من توزيع OSM Injector والجراب وصحة الخدمة باستخدام kubectl get deployment,pod,service الأمر .

    kubectl get deployment,pod,service -n kube-system --selector app=osm-injector
    

    يعطي OSM Injector السليم إخراجا مشابها لإخراج المثال التالي:

    NAME                           READY   UP-TO-DATE   AVAILABLE   AGE
    deployment.apps/osm-injector   2/2     2            2           4m37s
    
    NAME                                READY   STATUS    RESTARTS   AGE
    pod/osm-injector-5c49bd8d7c-b6cx6   1/1     Running   0          4m21s
    pod/osm-injector-5c49bd8d7c-dx587   1/1     Running   0          4m37s
    
    NAME                   TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)    AGE
    service/osm-injector   ClusterIP   10.96.236.108   <none>        9090/TCP   4m37s
    

تحقق من توزيع OSM Bootstrap والجراب والخدمة

  • تحقق من توزيع OSM Bootstrap، والجراب، وصحة kubectl get deployment,pod,service الخدمة باستخدام الأمر .

    kubectl get deployment,pod,service -n kube-system --selector app=osm-bootstrap
    

    يعطي OSM Bootstrap السليم إخراجا مشابها لإخراج المثال التالي:

    NAME                            READY   UP-TO-DATE   AVAILABLE   AGE
    deployment.apps/osm-bootstrap   1/1     1            1           5m25s
    
    NAME                                 READY   STATUS    RESTARTS   AGE
    pod/osm-bootstrap-594ffc6cb7-jc7bs   1/1     Running   0          5m25s
    
    NAME                    TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)             AGE
    service/osm-bootstrap   ClusterIP   10.96.250.208   <none>        9443/TCP,9095/TCP   5m25s
    

التحقق من صحة الإخطارات على الويب وتحورها

  1. تحقق من OSM Validating Webhook باستخدام kubectl get ValidatingWebhookConfiguration الأمر .

    kubectl get ValidatingWebhookConfiguration --selector app=osm-controller
    

    يعطي OSM validating Webhook السليم إخراجا مشابها لإخراج المثال التالي:

    NAME              WEBHOOKS   AGE
    aks-osm-validator-mesh-osm   1      81m
    
  2. تحقق من إخطار على الويب الخاص بتمحور OSM باستخدام kubectl get MutatingWebhookConfiguration الأمر .

    kubectl get MutatingWebhookConfiguration --selector app=osm-injector
    

    يعطي خطاف الويب الخاص بتحول OSM السليم إخراجا مشابها لإخراج المثال التالي:

    NAME              WEBHOOKS   AGE
    aks-osm-webhook-osm   1      102m
    

تحقق من الخدمة وحزمة CA من إخطار على الويب للتحقق من الصحة

  • تحقق من الخدمة وحزمة CA الخاصة ب OSM Validating Webhook باستخدام kubectl get ValidatingWebhookConfiguration الأمر مع aks-osm-validator-mesh-osm و jq '.webhooks[0].clientConfig.service'.

    kubectl get ValidatingWebhookConfiguration aks-osm-validator-mesh-osm -o json | jq '.webhooks[0].clientConfig.service'
    

    يبدو تكوين Validating Webhook الذي تم تكوينه بشكل جيد مثل إخراج JSON المثال التالي:

    {
      "name": "osm-config-validator",
      "namespace": "kube-system",
      "path": "/validate-webhook",
      "port": 9093
    }
    

تحقق من الخدمة وحزمة CA للإخطار على الويب المتحور

  • تحقق من الخدمة وحزمة CA من خطاف الويب الخاص بتحور OSM باستخدام kubectl get ValidatingWebhookConfiguration الأمر مع aks-osm-validator-mesh-osm و jq '.webhooks[0].clientConfig.service'.

    kubectl get MutatingWebhookConfiguration aks-osm-webhook-osm -o json | jq '.webhooks[0].clientConfig.service'
    

    يبدو تكوين Webhook المتحور المكون جيدا مثل مثال إخراج JSON التالي:

    {
      "name": "osm-injector",
      "namespace": "kube-system",
      "path": "/mutate-pod-creation",
      "port": 9090
    }
    

تحقق من osm-mesh-config المورد

  1. تحقق من وجود مورد OSM MeshConfig باستخدام kubectl get meshconfig الأمر .

    kubectl get meshconfig osm-mesh-config -n kube-system
    
  2. تحقق من محتويات مورد OSM MeshConfig باستخدام kubectl get meshconfig الأمر مع -o yaml.

    kubectl get meshconfig osm-mesh-config -n kube-system -o yaml
    
    apiVersion: config.openservicemesh.io/v1alpha1
    kind: MeshConfig
    metadata:
      creationTimestamp: "0000-00-00A00:00:00A"
      generation: 1
      name: osm-mesh-config
      namespace: kube-system
      resourceVersion: "2494"
      uid: 6c4d67f3-c241-4aeb-bf4f-b029b08faa31
    spec:
      certificate:
        serviceCertValidityDuration: 24h
      featureFlags:
        enableEgressPolicy: true
        enableMulticlusterMode: false
        enableWASMStats: true
      observability:
        enableDebugServer: true
        osmLogLevel: info
        tracing:
          address: jaeger.kube-system.svc.cluster.local
          enable: false
          endpoint: /api/v2/spans
          port: 9411
      sidecar:
        configResyncInterval: 0s
        enablePrivilegedInitContainer: false
        envoyImage: mcr.microsoft.com/oss/envoyproxy/envoy:v1.18.3
        initContainerImage: mcr.microsoft.com/oss/openservicemesh/init:v0.9.1
        logLevel: error
        maxDataPlaneConnections: 0
        resources: {}
      traffic:
        enableEgress: true
        enablePermissiveTrafficPolicyMode: true
        inboundExternalAuthorization:
          enable: false
          failureModeAllow: false
          statPrefix: inboundExtAuthz
          timeout: 1s
        useHTTPSIngress: false
    

osm-mesh-config قيم الموارد

المفتاح النوع القيمة الافتراضية أمثلة أوامر Kubectl Patch
spec.traffic.enableEgress منطقي true kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"traffic":{"enableEgress":true}}}' --type=merge
spec.traffic.enablePermissiveTrafficPolicyMode منطقي true kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"traffic":{"enablePermissiveTrafficPolicyMode":true}}}' --type=merge
spec.traffic.useHTTPSIngress منطقي false kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"traffic":{"useHTTPSIngress":true}}}' --type=merge
spec.traffic.outboundPortExclusionList صفيف [] kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"traffic":{"outboundPortExclusionList":[6379,8080]}}}' --type=merge
spec.traffic.outboundIPRangeExclusionList صفيف [] kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"traffic":{"outboundIPRangeExclusionList":["10.0.0.0/32","1.1.1.1/24"]}}}' --type=merge
spec.traffic.inboundPortExclusionList صفيف [] kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"traffic":{"inboundPortExclusionList":[6379,8080]}}}' --type=merge
spec.certificate.serviceCertValidityDuration سلسلة "24h" kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"certificate":{"serviceCertValidityDuration":"24h"}}}' --type=merge
spec.observability.enableDebugServer منطقي true kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"observability":{"enableDebugServer":true}}}' --type=merge
spec.observability.tracing.enable منطقي false kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"observability":{"tracing":{"enable":true}}}}' --type=merge
spec.observability.tracing.address سلسلة "jaeger.kube-system.svc.cluster.local" kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"observability":{"tracing":{"address": "jaeger.kube-system.svc.cluster.local"}}}}' --type=merge
spec.observability.tracing.endpoint سلسلة "/api/v2/spans" kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"observability":{"tracing":{"endpoint":"/api/v2/spans"}}}}' --type=merge' --type=merge
spec.observability.tracing.port العدد الصحيح 9411 kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"observability":{"tracing":{"port":9411}}}}' --type=merge
spec.observability.tracing.osmLogLevel سلسلة "info" kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"observability":{"tracing":{"osmLogLevel": "info"}}}}' --type=merge
spec.sidecar.enablePrivilegedInitContainer منطقي false kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"sidecar":{"enablePrivilegedInitContainer":true}}}' --type=merge
spec.sidecar.logLevel سلسلة "error" kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"sidecar":{"logLevel":"error"}}}' --type=merge
spec.sidecar.maxDataPlaneConnections العدد الصحيح 0 kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"sidecar":{"maxDataPlaneConnections":"error"}}}' --type=merge
spec.sidecar.envoyImage سلسلة "mcr.microsoft.com/oss/envoyproxy/envoy:v1.19.1" kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"sidecar":{"envoyImage":"mcr.microsoft.com/oss/envoyproxy/envoy:v1.19.1"}}}' --type=merge
spec.sidecar.initContainerImage سلسلة "mcr.microsoft.com/oss/openservicemesh/init:v0.11.1" kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"sidecar":{"initContainerImage":"mcr.microsoft.com/oss/openservicemesh/init:v0.11.1"}}}' --type=merge
spec.sidecar.configResyncInterval سلسلة "0s" kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"sidecar":{"configResyncInterval":"30s"}}}' --type=merge
spec.featureFlags.enableWASMStats منطقي "true" kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"featureFlags":{"enableWASMStats":"true"}}}' --type=merge
spec.featureFlags.enableEgressPolicy منطقي "true" kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"featureFlags":{"enableEgressPolicy":"true"}}}' --type=merge
spec.featureFlags.enableMulticlusterMode منطقي "false" kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"featureFlags":{"enableMulticlusterMode":"false"}}}' --type=merge
spec.featureFlags.enableSnapshotCacheMode منطقي "false" kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"featureFlags":{"enableSnapshotCacheMode":"false"}}}' --type=merge
spec.featureFlags.enableAsyncProxyServiceMapping منطقي "false" kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"featureFlags":{"enableAsyncProxyServiceMapping":"false"}}}' --type=merge
spec.featureFlags.enableIngressBackendPolicy منطقي "true" kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"featureFlags":{"enableIngressBackendPolicy":"true"}}}' --type=merge
spec.featureFlags.enableEnvoyActiveHealthChecks منطقي "false" kubectl patch meshconfig osm-mesh-config -n kube-system -p '{"spec":{"featureFlags":{"enableEnvoyActiveHealthChecks":"false"}}}' --type=merge

التحقق من مساحات الأسماء

إشعار

kube-system لا تشارك مساحة الاسم أبدا في شبكة خدمة ولا يتم تسميتها و/أو تعليقها بالمفتاح/القيم التالية.

osm namespace add يسمح لك الأمر بضم مساحات الأسماء إلى شبكة خدمة معينة. عندما تريد أن تكون مساحة اسم K8s جزءا من الشبكة، يجب أن تحتوي على التعليق التوضيحي والتسمية التالية.

  1. عرض التعليقات التوضيحية باستخدام kubectl get namespace الأمر مع jq '.metadata.annotations'.

    kubectl get namespace bookbuyer -o json | jq '.metadata.annotations'
    

    يجب أن تشاهد التعليق التوضيحي التالي في الإخراج:

    {
      "openservicemesh.io/sidecar-injection": "enabled"
    }
    
  2. عرض التسميات باستخدام kubectl get namespaces الأمر مع jq '.metadata.labels'.

    kubectl get namespace bookbuyer -o json | jq '.metadata.labels'
    

    يجب أن تشاهد التسمية التالية في الإخراج:

    {
      "openservicemesh.io/monitored-by": "osm"
    }
    

إذا لم يكن لمساحة الاسم التعليق التوضيحي "openservicemesh.io/sidecar-injection": "enabled" أو التسمية "openservicemesh.io/monitored-by": "osm" ، فلا يضيف OSM Injector العلامات الجانبية Envoy.

إشعار

بعد osm namespace add استدعاء ، يتم حقن القرون الجديدة فقط مع Envoy sidecar. يجب إعادة تشغيل الجرابات الموجودة باستخدام kubectl rollout restart deployment ...

التحقق من OSM CRDs

  1. تحقق من أن نظام المجموعة يحتوي على CRDs المطلوبة باستخدام kubectl get crds الأمر .

    kubectl get crds
    

    يجب تثبيت CRDs التالية على نظام المجموعة:

    • egresses.policy.openservicemesh.io
    • httproutegroups.specs.smi-spec.io
    • ingressbackends.policy.openservicemesh.io
    • رقم A0.openservicemesh.io
    • رقم A0.openservicemesh.io
    • tcproutes.specs.smi-spec.io
    • trafficsplits.split.smi-spec.io
    • traffictargets.access.smi-spec.io
  2. احصل على إصدارات SMI CRDs المثبتة osm mesh list باستخدام الأمر .

    osm mesh list
    

    يجب أن يبدو الإخراج مشابها لإخراج المثال التالي:

    MESH NAME   MESH NAMESPACE   VERSION   ADDED NAMESPACES
    osm         kube-system      v0.11.1
    
    MESH NAME   MESH NAMESPACE   SMI SUPPORTED
    osm         kube-system      HTTPRouteGroup:v1alpha4,TCPRoute:v1alpha4,TrafficSplit:v1alpha2,TrafficTarget:v1alpha3
    
    To list the OSM controller pods for a mesh, please run the following command passing in the mesh's namespace
            kubectl get pods -n <osm-mesh-namespace> -l app=osm-controller
    

    تحتاج وحدة التحكم في OSM النسخة 11.1 إلى الإصدارات التالية:

    • traffictargets.access.smi-spec.io - v1alpha3
    • httproutegroups.specs.smi-spec.io - v1alpha4
    • tcproutes.specs.smi-spec.io - v1alpha4
    • udproutes.specs.smi-spec.io - غير مدعوم
    • trafficsplits.split.smi-spec.io - v1alpha2
    • *.metrics.smi-spec.io - v1alpha1

إدارة الشهادات

لمزيد من المعلومات حول كيفية إصدار OSM للشهادات وإدارتها لوكلاء Envoy الذين يعملون على pods التطبيق، راجع دليل شهادات OSM.

ترقية Envoy

عند إنشاء جراب جديد في مساحة اسم تراقبها الوظيفة الإضافية، يقوم OSM بإدخال وكيل Envoy sidecar في ذلك الجراب. لمزيد من المعلومات حول كيفية تحديث إصدار Envoy، راجع دليل ترقية OSM.