Using mesheryctl

Meshery’s command line interface is mesheryctl. Use mesheryctl to both manage the lifecyle of Meshery itself and to access and invoke any of Meshery’s application and service mesh management functions. mesheryctl commands can be categorized as follows:

  • mesheryctl - Global overrides and flags
  • mesheryctl filter - Service Mesh Filter Management
  • mesheryctl mesh - Service Mesh Lifecycle & Configuration Management
  • mesheryctl perf - Service Mesh Performance Management
  • mesheryctl pattern - Service Mesh Pattern Configuration & Management
  • mesheryctl system - Meshery Lifecycle and Troubleshooting

Configuring Meshery Deployments with meshconfig

Meshconfig refers to a configuration file found at ~/.meshery/config.yaml. Your meshconfig file must contain one or more contexts in order for any mesheryctl system command to work. Each context represents a Meshery deployment.

Each of the system commands are used to control Meshery’s lifecycle like system start, stop, status, reset and so on.

Meshery CLI FAQ

Question: What are differences between contexts ?

Each context is a block that defines certain parameters that are specific to meshery itself. This helps the user to save multiple configurations of the meshery instance, switching between them with ease.

Question: Why are contexts necessary ?

Having configured multiple contexts and switched between environments enabled automation during the deployment process.

Approach: Context allows us to maining context data in the configuration file similar to kube contexts. The properties could be under the context-name object and the current context can be stored using a current- context key.

Question: What is current-context?

current-context identifies the Meshery deployment that when any mesheryctl command is invoked will use the environment described in the current-context. You can switch between contexts. Only one context can be the current-context.

Question: What’s the difference between contexts and environments?

Contexts configure Meshery deployments (server, adapters, operator and so on), while environments define a collection of Kubernetes clusters and service meshes under management in Meshery.

Question: What does the default meshconfig look like?

The following template is used to create a config file from scratch. Not all of the following variables are required to be included. Some of the variables may have a null value or may be excluded (e.g. “adapters”).

contexts:
    <context1-name>:
      endpoint: <url to meshery server rest api>
      token: <name of token variable in this config file>
      platform: <type of platform: ”docker” or “kubernetes”>
      # Future: specify type of kubernetes (e.g. eks)
      adapters: <collection of names of service mesh adapters:
          “istio”,“linkerd”,”consul”,”nginx-sm”,”octarine”,”tanzu-sm”,”citrix-sm”,”kuma”,”osm”,”nsm”>

   <context2-name>:
    endpoint: <url to meshery server rest api>
    token: <name of token variable in this config file>
    platform: <type of platform: ”docker” or “kubernetes”>
    current-context: <context name>

tokens:
- name: <token1-name>
  location: <token-location>
- name: <token2-name>
  value: <token-value>
  # Future: allow embedding of token certificate

Try it out and see for yourself. Run mesheryctl system context create test and mesheryctl system context view test.

Question: How do endpoints work in meshconfig?

Endpoints specify the access URL for the Meshery UI, for a deployment. Endpoints are developed based on platform:

  • Docker: Docker users can specify the endpoint in the meshconfig. The port specified in this will be used to generate the endpoint. The endpoint is of the form http://localhost:port, where port is taken from the meshconfig.
  • Kubernetes: Deployments with kubernetes as the platform have an endpoint generated by service discovery using the Kubernetes API. This endpoint overwrites the endpoint specified in the meshconfig.

Advanced Installation

Users can control the specific container image and tag (version) of Meshery that they would like to run by editing their local ~/.meshery/meshery.yaml (a docker compose file). Aligned with the Meshery container image, instead of leaving the implicit :stable-latest tag behind image: layer5/meshery, users will instead identify a specific image tag like so:

bash
version: '3'
services:
  meshery:
    image: layer5/meshery:v0.5.0
    labels:
      - "com.centurylinklabs.watchtower.enable=true"

Suggested Reading

For an exhaustive list of mesheryctl commands and syntax:

Guides to using Meshery’s various features and components.