

kubectl label namespace <namespace name> polaris-injection=enabled
kubectl get namespace -L polaris-injectionOutput results:NAME STATUS AGE POLARIS-INJECTIONdefault Active 3d2h enabled
label Key | Scope | label Value | Meaning | polaris-controller Version |
polarismesh.cn/inject | Pod | disabled | Declares that when default injection is enabled for the namespace, it serves as a blocklist feature to specify that the pod does not inject javaagent. | v1.7.3 and later versions |
polarismesh.cn/inject | Pod | enabled | Declares that when default injection is not enabled for the namespace, it serves as an allowlist feature to individually specify that the pod injects javaagent. | v1.7.3 and later versions |
polarismesh.cn/inject | Namespace | enabled | Declares that pods under the namespace are injected with javaagent by default. | v1.7.3 and later versions |
polaris-injection | Namespace | enabled | Declares that pods under the namespace are injected with javaagent by default. | Supported by all versions, to be deprecated, use polarismesh.cn/inject instead. |
apiVersion: v1kind: Namespacemetadata:name: java-agent-testlabels:polarismesh.cn/inject: enabled
apiVersion: apps/v1kind: Deploymentmetadata:name: label-blocknamespace: java-agent-testspec:selector:matchLabels:app: label-blocktemplate:metadata:labels:app: label-blockpolarismesh.cn/inject: disabledannotations:polarismesh.cn/javaagent: "true"spec:......
apiVersion: apps/v1kind: Deploymentmetadata:name: label-allowspec:selector:matchLabels:app: label-allowtemplate:metadata:labels:app: label-allowpolarismesh.cn/inject: enabledannotations:polarismesh.cn/javaagent: "true"spec:......
Annotation Key | Annotation Value | Meaning | polaris-controller Version |
polarismesh.cn/javaagent | Supported values: "true", "false". Required. | Declares that Java Agent needs to be injected into this POD. | Supported by all versions |
polarismesh.cn/workloadNamespaceAsServiceNamespace | Supported values: "true", "false". Optional. | Declares that the Kubernetes namespace is used as the service namespace for registration to Polaris. If it conflicts with the configuration in polarismesh.cn/javaagentConfig, this configuration does not take effect. | v1.7.3 and later versions |
polarismesh.cn/workloadNameAsServiceName | Supported values: "true", "false". Optional. | Declares that the Kubernetes workload name is used as the service name for registration to Polaris. If it conflicts with the configuration in polarismesh.cn/javaagentConfig, this configuration does not take effect. | v1.7.3 and later versions |
polarismesh.cn/javaagentFrameworkName | If not specified, the application framework type is automatically identified. Supported value: spring-cloud. | Declares the application framework type. For SpringCloud applications, fill in spring-cloud. Currently, only the SpringCloud type is supported. | Supported by all versions |
polarismesh.cn/javaagentFrameworkVersion | If not specified, the application framework version is automatically identified. Also supports manual declaration of the framework version, for example: 2023, 2022, hoxton, etc. | Declares the application framework version. | Supported by all versions |
polarismesh.cn/javaagentVersion | For example: 2.0.1.0. Note: For production environments, specify a validated version. If no version is specified, the latest version is automatically injected each time an instance restarts. This may introduce compatibility issues with the new version, potentially causing the instance to fail to start properly. | Declares the image version of the Java Agent package. | Supported by all versions |
polarismesh.cn/javaagentConfig | For specifying the namespace, service name, and configuring lossless deployment: '{"spring.cloud.polaris.lossless.enabled":"true","spring.cloud.polaris.lossless.delay-register-interval":"30000","spring.cloud.polaris.discovery.namespace":"custom-ns","spring.application.name":"custom-service"}' | Supports user-defined Java Agent configurations, including specifying the namespace, service name, service instance metadata, lossless deployment configurations, and more. The format is JSON. Configurations not specified use the default configurations. | Supported by all versions |
apiVersion: apps/v1kind: Deploymentmetadata:name: default-ns-namenamespace: java-agent-testspec:selector:matchLabels:app: default-ns-nametemplate:metadata:labels:app: default-ns-nameannotations:polarismesh.cn/javaagent: "true"spec:......
apiVersion: apps/v1kind: Deploymentmetadata:name: k8s-info-injectnamespace: java-agent-testspec:selector:matchLabels:app: k8s-info-injecttemplate:metadata:labels:app: k8s-info-injectannotations:polarismesh.cn/javaagent: "true"polarismesh.cn/workloadNamespaceAsServiceNamespace: "true"polarismesh.cn/workloadNameAsServiceName: "true"spec:......
apiVersion: apps/v1kind: Deploymentmetadata:name: custom-ns-namenamespace: java-agent-testspec:selector:matchLabels:app: custom-ns-nametemplate:metadata:labels:app: custom-ns-nameannotations:polarismesh.cn/javaagent: "true"polarismesh.cn/javaagentConfig: '{"spring.cloud.polaris.discovery.namespace": "custom-ns","spring.application.name":"custom-service"}'spec:......
......2024-02-01 21:19:16 [INFO ](PolarisAgentBootStrap) [Bootstrap] start bootStrapStarter:default......2024-02-01 21:19:16 [INFO ](PluginCreator) [BootStrap] plugin spring-cloud-hoxton-plugin has been loading
plugins.enable=spring-cloud-2023-plugin
# Application name (required)spring.application.name=testSvcName# Configuration of Polaris Server Addressspring.cloud.polaris.address=grpc\\://9.134.5.52\\:8091
-javaagent:<java-agent installation directory>/polaris-agent-core-bootstrap.jar to the application's startup parameters, then restart the application to complete the java-agent injection.-javaagent parameter under VM Options.Esta página foi útil?
Você também pode entrar em contato com a Equipe de vendas ou Enviar um tíquete em caso de ajuda.
comentários