OSM MeshConfig

OSM deploys a MeshConfig resource osm-mesh-config as a part of its control plane (in the same namespace as that of the osm-controller pod) which can be updated by the mesh owner/operator at any time. The purpose of this MeshConfig is to provide the mesh owner/operator the ability to update some of the mesh configurations based on their needs.

At the time of install, the OSM MeshConfig is deployed from a preset MeshConfig (preset-mesh-config) which can be found under charts/osm/templates.

First, set an environment variable to refer to the namespace where osm was installed.

  1. export osm_namespace=osm-system # Replace osm-system with the namespace where OSM is installed

To view your osm-mesh-config in CLI use the kubectl get command.

  1. kubectl get meshconfig osm-mesh-config -n "$osm_namespace" -o yaml

Note: Values in the MeshConfig osm-mesh-config are persisted across upgrades.

Configure OSM MeshConfig

Kubectl Patch Command

Changes to osm-mesh-config can be made using the kubectl patch command.

  1. kubectl patch meshconfig osm-mesh-config -n "$osm_namespace" -p '{"spec":{"traffic":{"enableEgress":true}}}' --type=merge

Refer to the Config API reference for more information.

If an incorrect value is used, validations on the MeshConfig CRD will prevent the change with an error message explaining why the value is invalid. For example, the below command shows what happens if we patch enableEgress to a non-boolean value.

  1. kubectl patch meshconfig osm-mesh-config -n "$osm_namespace" -p '{"spec":{"traffic":{"enableEgress":"no"}}}' --type=merge
  2. # Validations on the CRD will deny this change
  3. The MeshConfig "osm-mesh-config" is invalid: spec.traffic.enableEgress: Invalid value: "string": spec.traffic.enableEgress in body must be of type boolean: "string"

Kubectl Patch Command for Each Key Type

Note: <osm-namespace> refers to the namespace where the osm control plane is installed. By default, the osm namespace is osm-system.

KeyTypeDefault ValueKubectl Patch Command Examples
spec.traffic.enableEgressboolfalsekubectl patch meshconfig osm-mesh-config -n $osm_namespace -p ‘{“spec”:{“traffic”:{“enableEgress”:true}}}’ —type=merge
spec.traffic.enablePermissiveTrafficPolicyModeboolfalsekubectl patch meshconfig osm-mesh-config -n $osm_namespace -p ‘{“spec”:{“traffic”:{“enablePermissiveTrafficPolicyMode”:true}}}’ —type=merge
spec.traffic.useHTTPSIngressboolfalsekubectl patch meshconfig osm-mesh-config -n $osm_namespace -p ‘{“spec”:{“traffic”:{“useHTTPSIngress”:true}}}’ —type=merge
spec.traffic.outboundPortExclusionListarray[]kubectl patch meshconfig osm-mesh-config -n $osm_namespace -p ‘{“spec”:{“traffic”:{“outboundPortExclusionList”:6379,8080}}}’ —type=merge
spec.traffic.outboundIPRangeExclusionListarray[]kubectl patch meshconfig osm-mesh-config -n $osm_namespace -p ‘{“spec”:{“traffic”:{“outboundIPRangeExclusionList”:”10.0.0.0/32,1.1.1.1/24”}}}’ —type=merge
spec.traffic.networkInterfaceExclusionListarray[]kubectl patch meshconfig osm-mesh-config -n $osm_namespace -p ‘{“spec”:{“traffic”:{“networkInterfaceExclusionList”: [“eth0”, “net1”]}}}’ —type=merge
spec.certificate.serviceCertValidityDurationstring“24h”kubectl patch meshconfig osm-mesh-config -n $osm_namespace -p ‘{“spec”:{“certificate”:{“serviceCertValidityDuration”:”24h”}}}’ —type=merge
spec.observability.enableDebugServerboolfalsekubectl patch meshconfig osm-mesh-config -n $osm_namespace -p ‘{“spec”:{“observability”:{“serviceCertValidityDuration”:true}}}’ —type=merge
spec.observability.tracing.enablebool“jaeger.<osm-namespace>.svc.cluster.local”kubectl patch meshconfig osm-mesh-config -n $osm_namespace -p ‘{“spec”:{“observability”:{“tracing”:{“address”: “jaeger.<osm-namespace>.svc.cluster.local”}}}}’ —type=merge
spec.observability.tracing.addressstring“/api/v2/spans”kubectl patch meshconfig osm-mesh-config -n $osm_namespace -p ‘{“spec”:{“observability”:{“tracing”:{“endpoint”:”/api/v2/spans”}}}}’ —type=merge’ —type=merge
spec.observability.tracing.endpointstringfalsekubectl patch meshconfig osm-mesh-config -n $osm_namespace -p ‘{“spec”:{“observability”:{“tracing”:{“enable”:true}}}}’ —type=merge
spec.observability.tracing.portint9411kubectl patch meshconfig osm-mesh-config -n $osm_namespace -p ‘{“spec”:{“observability”:{“tracing”:{“port”:9411}}}}’ —type=merge
spec.sidecar.enablePrivilegedInitContainerboolfalsekubectl patch meshconfig osm-mesh-config -n $osm_namespace -p ‘{“spec”:{“sidecar”:{“enablePrivilegedInitContainer”:true}}}’ —type=merge
spec.sidecar.logLevelstring“error”kubectl patch meshconfig osm-mesh-config -n $osm_namespace -p ‘{“spec”:{“sidecar”:{“logLevel”:”error”}}}’ —type=merge
spec.sidecar.maxDataPlaneConnectionsint0kubectl patch meshconfig osm-mesh-config -n $osm_namespace -p ‘{“spec”:{“sidecar”:{“maxDataPlaneConnections”:0}}}’ —type=merge
spec.sidecar.envoyImagestring“envoyproxy/envoy-alpine:v1.17.2”kubectl patch meshconfig osm-mesh-config -n $osm_namespace -p ‘{“spec”:{“sidecar”:{“envoyImage”:”envoyproxy/envoy-alpine:v1.17.2”}}}’ —type=merge
spec.sidecar.localProxyModestring“Localhost”kubectl patch meshconfig osm-mesh-config -n $osm_namespace -p ‘{“spec”:{“sidecar”:{“localProxyMode”:”Localhost”}}}’ —type=merge
spec.sidecar.initContainerImagestring“openservicemesh/init:v0.9.2”kubectl patch meshconfig osm-mesh-config -n $osm_namespace -p ‘{“spec”:{“sidecar”:{“initContainerImage”:”openservicemesh/init:v0.9.2”}}}’ —type=merge
spec.sidecar.configResyncIntervalstring“0s”kubectl patch meshconfig osm-mesh-config -n $osm_namespace -p ‘{“spec”:{“sidecar”:{“configResyncInterval”:”30s”}}}’ —type=merge