In this post, I would be showing you how to deploy Meshery on Kubernetes using Kind but first…
What the heck is Meshery?
If you are reading this chances are you are already familiar with Meshery or you are looking to find out what it is. Well, you are in the right place.
Meshery is an open-source Service Mesh management plane. In simpler terms Meshery allows you to orchestrate the installation and management of different Service Meshes, Meshery also allows you to evaluate the performance of Service Meshes using the SMP specification These are just two of the features Meshery provides out of the box. If I have gotten you a tiny bit interested in Meshery head over to https://docs.meshery.io/functionality for a list of additional features Meshery provides.
Now that you’re familiar with what Meshery is let's get it installed.
Setup
Before we get started be sure you have docker and go installed as both are requirements for installing Kind, we'll also be needing helm to deploy Meshery
Installing Kind
to install Kind run the following command
GO111MODULE="on" go get sigs.k8s.io/kind@v0.11.1
if you run into an error along the lines of :
zsh: command not found: kind
Try adding the following alias to your shell configuration
alias kind="$GOBIN/kind"
Creating a cluster
Next, we'll create a kind cluster with an Ingress enabled, this ingress will come in handy when we want to expose Meshery later on.
Create a file called cluster.yaml
and populate the file with the following code:
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
kubeadmConfigPatches:
- |
kind: InitConfiguration
nodeRegistration:
kubeletExtraArgs:
node-labels: "ingress-ready=true"
extraPortMappings:
- containerPort: 80
hostPort: 80
protocol: TCP
- containerPort: 443
hostPort: 443
protocol: TCP
Now we the following command to create a cluster using the cluster configuration
kind create cluster --name meshery --config cluster.yaml
After a few minutes, you should have a Kubernetes cluster up and running.
Installing Meshery
hop into your terminal and run the following command to get Meshery installed
$ git clone https://github.com/layer5io/meshery.git; cd meshery
$ kubectl create namespace meshery
$ helm install meshery --namespace meshery install/kubernetes/helm/meshery
Exposing meshery
As mentioned earlier on we would access Meshery by using Ingress, create a file called meshery-ingress.yaml
, and add the following configuration:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: meshery-ingress
labels:
name: meshery-ingress
spec:
rules:
- host: meshery.local
http:
paths:
- pathType: Prefix
path: "/"
backend:
service:
name: meshery
port:
number: 9081
Apply the configuration using kubectl apply -n meshery -f meshery-ingress.yaml
.
Now create the following entry in /etc/hosts
127.0.0.1 meshery.local
At this point if you head over to http://meshery.local in your browser you should be able to access Meshery's UI which looks something like this.
Configuring Meshery's command-line client
While you could interact with Meshery from the UI only, at some point you are going to want to use the command line client which is what mesheryctl is. So let's get that installed.
Head over to https://github.com/meshery/meshery/releases/ and download the binary for your operating system. Next unzip the file and move it to your path
unzip mesheryctl_0.5.52_Darwin_x86_64.zip
mv mesheryctl /usr/local/bin/mesheryctl
The version of the binary might differ depending on when you are reading this.
Now that you have mesheryctl installed you should be able to run mesheryctl version
.On your first try you should see something like this
~
❯ mesheryctl version
Missing Meshery config file.
Create default config now [y/n]?
enter y
and mesheryctl would generate a config file which we would also be needing later on.
if all went well you should be presented with this error message
Default config file created at /Users/someguy/.meshery/config.yaml
VERSION GITSHA
Client v0.5.62 35e8d943
Server unavailable unavailable
Unable to communicate with Meshery: Get "http://localhost:9081/api/system/version": dial tcp [::1]:9081: connect: connection refused
See https://docs.meshery.io for help getting started with Meshery.
Checking for latest version of mesheryctl...
v0.5.62 is the latest release.
This happens because mesheryctl is trying to communicate with Meshery on the default address, in our case it's http://meshery.local. Luckily we can change this using the config file Meshery generated earlier.
Open up the config file located at ~/.meshery/config.yaml
contexts:
local:
endpoint: http://localhost:9081
token: Default
platform: docker
adapters:
- meshery-istio
- meshery-linkerd
- meshery-consul
- meshery-nsm
- meshery-kuma
- meshery-cpx
- meshery-osm
- meshery-traefik-mesh
- meshery-nginx-sm
channel: stable
version: latest
current-context: local
tokens:
- name: Default
location: auth.json
Taking a closer look we see that the endpoint is set to [localhost:9081](http://localhost:9081)
, modify the file so it looks like this
contexts:
local:
endpoint: http://meshery.local
token: Default
platform: kubernetes
adapters:
- meshery-istio
- meshery-linkerd
- meshery-consul
- meshery-nsm
- meshery-kuma
- meshery-cpx
- meshery-osm
- meshery-traefik-mesh
- meshery-nginx-sm
channel: stable
version: latest
current-context: local
tokens:
- name: Default
location: auth.json
Here i changed the endpoint and platform to match our current configuration. Now run mesheryctl version
again and you should see the following:
❯ mesheryctl version
VERSION GITSHA
Client v0.5.62 35e8d943
Server v0.5.62 35e8d943
Checking for latest version of mesheryctl...
And there you go, we successfully deployed Meshery in kind and configured the CLI to interact with Meshery. If you have any questions or want to contribute to the Meshery project feel free to join the slack workspace using the link here. Now go forth and make a mesh of things
Top comments (1)
There has been so much thought put into
mesheryctl
. What a good way to introduce meshconfig for customizing Meshery deployments.