Prerequisites

Prepare Minikube

Start Minikube as you normally would. Note that the following command also enables role-based access control (RBAC) (which is disabled by default on Minikube version 0.24.1 and later) so that you can get more comfortable working with an RBAC-enabled Kubernetes cluster:

Set admin permissions: bypass Minikube configuration issues by giving cluster-admin permissions to the Kubernetes services, so that services such as kube-dns can work in Minikube:

Note

You are encouraged to look at the kubedns-rbac file that’s used in the following command, and the RBAC configuration files usd in the Nuclio installation section, before applying the files, so that you don’t get into the habit of blindly running things on your cluster (akin to running scripts off the internet as root).
If you don’t want to elevate your Kubernetes services, run Minikube with RBAC disabled (omit --extra-config from minikube start) and skip the RBAC related commands in the Nuclio installation instructions.

Before Docker images can be pushed to your built-in registry, you need to add its address ($(minikube ip):5000) to the list of insecure registries. If you’re using Docker for Mac OS, you can add it under Preferences > Daemon.

Install Nuclio

At this stage you should have a functioning Kubernetes cluster, a Docker registry, and a working Kubernetes CLI (kubectl), and you can proceed to install the Nuclio services on the cluster (i.e., deploy Nuclio).

Create a Nuclio namespace by running the following command:

Note

All Nuclio resources go into the “nuclio” namespace, and role-based access control (RBAC) is configured accordingly.

kubectl create namespace nuclio

Create the RBAC roles that are required for using Nuclio (provided you didn’t disable RBAC when preparing Minikube):
> As indicated in the Minikube preparation instructions, you are encouraged to look at the nuclio-rbac.yaml file that’s used in the following command before applying it.

Deploy a function with the Nuclio dashboard

Browse to http://localhost:8070 (after having forwarded this port as part of the Nuclio installation). You should see the Nuclio dashboard UI. Choose one of the built-in examples and click Deploy. The first build will populate the local Docker cache with base images and other files, so it might take a while, depending on your network. When the function deployment is completed, you can click Invoke to invoke the function with a body.

Deploy a function with the Nuclio CLI (nuctl)

Start by downloading the latest version of the nuctl Nuclio CLI for your platform, and then deploy the helloworld Go sample function. You can add the --verbose flag if you want to peek under the hood:

The difference between the two registries specified in this command and the reason for their addresses being different is as follows:

The --registry option defines the Docker registry onto which the function images that you build will be pushed. This is the registry that you previously brought up on your Minikube VM.

The --registry-run option defines the registry from which the kubelet Kubernetes “node agent” will pull the function images. Because this operation occurs in the Minikube VM, the command specifies localhost instead of the VM’s IP address.

Then, invoke the function:

nuctl invoke -n nuclio helloworld

What’s next?

See the following resources to make the best of your new Nuclio environment: