Back to Meshery

Minikube

docs/content/en/installation/kubernetes/minikube.md

1.0.189.0 KB
Original Source
<h1>Quick Start with Minikube </h1>

Meshery can manage your minikube clusters and is particularly useful for multi-cluster management and deployments.

For Meshery to manage your Minikube cluster, it has to be discovered and added as a Kubernetes connection in the Meshery server.

After your cluster has been added as a connection, you can use Meshery to make infrastructure deployments of your Meshery Designs to your cluster. To learn more about this, See Deploying Meshery Designs. You can also Visualize the resources in your cluster in Operator Mode, See Views in Visualizer.

There are two ways to create this connection:

  1. Deploying Meshery in minikube (in-cluster).
  2. Deploying Meshery using Docker and connect it to minikube (out-of-cluster).

Note: It is advisable to install Meshery in your Minikube clusters

<div class="prereqs"><p><strong style="font-size: 20px;">Prerequisites</strong> </p> <ol> <li>Install the Meshery command-line client, <a href="/installation/mesheryctl" class="meshery-light">mesheryctl</a>.</li> <li>Install <a href="https://kubernetes.io/docs/tasks/tools/">kubectl</a> on your local machine.</li> <li>Install <a href="https://minikube.sigs.k8s.io/docs/start/?arch=%2Fmacos%2Fx86-64%2Fstable%2Fbinary+download"> Minikube</a> on your local machine.</li> <li>Install <a href="https://helm.sh/docs/intro/install/">Helm</a>.</li> </ol> </div>

Also see: Install Meshery on Kubernetes

Available Deployment Methods

Preflight Checks

Before deploying Meshery on minikube, complete the following initial setup tasks to prepare your environment.

1. Preflight: Cluster Connectivity

Start minikube using the following command if it is not already running:

{{< code code="minikube start" >}}

Check the status of your minikube cluster by running:

{{< code code="minikube status" >}}

Verify that the current context is set to minikube by running:

{{< code code="kubectl config current-context" >}}

2. Preflight: Meshery Authentication

Ensure you are logged in and authenticated with Meshery by running the following command:

{{< code code="mesheryctl system login" >}}

In-cluster Installation

Installation: Install Meshery on Kubernetes Using mesheryctl

To install Meshery inside your minikube cluster, run the command:

{{< code code="mesheryctl system start -p kubernetes" >}} This command deploys the Meshery Helm chart in the Meshery namespace.

To verify your deployment, run:

{{< code code="helm list -A -n meshery" >}} After deployment, access the Meshery UI using port forwarding, with the command:

{{< code code="mesheryctl system dashboard --port-forward" >}} For detailed instructions on port forwarding, refer to the port-forwarding guide.

By default, Meshery auto-detects your Minikube cluster and establishes a connection. However, if this doesn’t happen, you can connect by running the following command:

{{< code code="mesheryctl system config minikube" >}}

The mesheryctl system config minikube command properly configures and uploads your kubeconfig file to the Meshery UI.

<a href="/installation/kubernetes/images/minikube-upload.png"></a>

Installation: Using Helm

You can deploy Meshery directly using the Helm CLI. For detailed instructions on installing Meshery using Helm V3, please refer to the Helm Installation guide.

Out-of-cluster Installation

To install Meshery on Docker(out-of-cluster) and connect it to your Minikube cluster, follow these steps:

Installation: Install Meshery on Docker

Run the following command to start Meshery in a Docker environment:

{{< code code="mesheryctl system start -p docker" >}} This will start Meshery in Docker containers. To verify that Meshery is running, use

{{< code code="docker ps" >}}

Meshery UI will be accessible on your local machine on port 9081. Open your browser and access Meshery at http://localhost:9081.

Configure Meshery to connect with your minikube cluster by running the command:

{{< code code="mesheryctl system config minikube" >}}

Minikube Docker Driver Users

For users running minikube with the Docker driver, specific steps are needed to ensure that Meshery can connect properly to your minikube cluster.

If you set up your minikube cluster using the Docker driver, both minikube and Meshery will be running in Docker containers. So, you need to ensure that the Meshery and minikube containers can communicate with each other by placing them in the same Docker network.

To configure this, run the following commands:

<pre class="codeblock-pre"><div class="codeblock"> <div class="clipboardjs">docker network connect bridge meshery-meshery-1</div></div> </pre> <pre class="codeblock-pre"><div class="codeblock"> <div class="clipboardjs">docker network connect minikube meshery-meshery-1</div></div> </pre>

Next, update the Kubernetes API server address in your kubeconfig file before running the mesheryctl system config minikube command. The steps to do this are outlined below.

Next Step: Update the Kubernetes API Server Address for Meshery Access

To allow the Meshery container to access your Minikube cluster (since both are running in containers), you need to update the Kubernetes API server address in your kubeconfig file to the external minikube IP address. This is necessary because Docker typically forwards ports to a localhost address, which isn’t accessible between containers.

To retrieve the Minikube IP, run the command minikube ip. To check which port minikube is using, run docker ps to view the container's port, which is typically 8443.

Open the kubeconfig file and update the server address.

{{< code code=`nano ~/.kube/config.yaml

Change the server address

server: https://{minikubeIP}:{port}` >}}

Ctrl + X then enter Y to save and close the file.

Next, run the following command to configure Meshery to access your cluster.

{{< code code="mesheryctl system config minikube" >}}

Note: An alternative to running the mesheryctl system config minikube command for Meshery to discover your cluster is manually uploading your config file to the UI.

Uploading Configuration File in the Meshery Web UI

Note: Meshery can only connect to your cluster if it is running locally (Kubernetes or Docker). Direct connections are not possible when using the hosted Meshery Playground.

To manually upload your kubeconfig file after running Meshery locally:

  1. In the Meshery UI, navigate to Lifecycle from the menu on the left.
  2. Click on Connections.
  3. Click on Add Cluster and search for your kubeconfig file.
  4. Click Import.

Note: If you encounter a connections refused error while uploading your kubeconfig, try changing your cluster server URL to the external API address of minikube. To do this follow the steps listed in the Minikube Docker Driver Users Section.

Troubleshooting Meshery Installation

If you experience any issues during installation, refer to the Troubleshooting Meshery Installations guide for help.

Post-Installation Steps

Verify the health of your Meshery deployment, using <a href='/reference/mesheryctl/system/check'>mesheryctl system check</a>.

{{< installation/accessing-meshery-ui >}}

{{< related-discussions tag="meshery" >}}