Install on Minikube

This guide walks you through the installation of the latest version of Knative Serving using pre-built images and demonstrates creating and deploying an image of a sample “hello world” app onto the newly created Knative cluster.

You can find guides for other platforms here.

Before you begin

Although Knative requires a Kubernetes cluster v1.11 or newer, installing Knative on Minikube requires a cluster v1.12 or newer.

Install kubectl and Minikube

  1. If you already have kubectl CLI, run kubectl version to check the version. You need v1.10 or newer. If your kubectl is older, follow the next step to install a newer version.

  2. Install the kubectl CLI.

  3. Install and configure minikube version v0.28.1 or later with a VM driver, e.g. kvm2 on Linux or hyperkit on macOS.

Creating a Kubernetes cluster

After kubectl and Minikube are installed, create a cluster with version 1.12 or greater and your chosen VM driver:

For Linux use:

minikube start --memory=8192 --cpus=6 \
  --kubernetes-version=v1.12.0 \
  --vm-driver=kvm2 \
  --disk-size=30g \
  --extra-config=apiserver.enable-admission-plugins="LimitRanger,NamespaceExists,NamespaceLifecycle,ResourceQuota,ServiceAccount,DefaultStorageClass,MutatingAdmissionWebhook"

For macOS use:

minikube start --memory=8192 --cpus=6 \
  --kubernetes-version=v1.12.0 \
  --vm-driver=hyperkit \
  --disk-size=30g \
  --extra-config=apiserver.enable-admission-plugins="LimitRanger,NamespaceExists,NamespaceLifecycle,ResourceQuota,ServiceAccount,DefaultStorageClass,MutatingAdmissionWebhook"

Installing Istio

Knative depends on Istio for traffic routing and ingress. You have the option of injecting Istio sidecars and enabling the Istio service mesh, but it’s not required for all Knative components.

If your cloud platform offers a managed Istio installation, we recommend installing Istio that way, unless you need the ability to customize your installation.

If you prefer to install Istio manually, if your cloud provider doesn’t offer a managed Istio installation, or if you’re installing Knative locally using Minkube or similar, see the Installing Istio for Knative guide.

Note: Ambassador and Gloo are available as an alternative to Istio. Click here to install Knative with Ambassador. Click here to install Knative with Gloo.

Installing Knative

The following commands install all available Knative components as well as the standard set of observability plugins. To customize your Knative installation, see Performing a Custom Knative Installation.

  1. If you are upgrading from Knative 0.3.x: Update your domain and static IP address to be associated with the LoadBalancer istio-ingressgateway instead of knative-ingressgateway. Then run the following to clean up leftover resources:
   kubectl delete svc knative-ingressgateway -n istio-system
   kubectl delete deploy knative-ingressgateway -n istio-system

If you have the Knative Eventing Sources component installed, you will also need to delete the following resource before upgrading:

   kubectl delete statefulset/controller-manager -n knative-sources

While the deletion of this resource during the upgrade process will not prevent modifications to Eventing Source resources, those changes will not be completed until the upgrade process finishes.

  1. To install Knative, first install the CRDs by running the kubectl apply command once with the -l knative.dev/crd-install=true flag. This prevents race conditions during the install, which cause intermittent errors:
   kubectl apply --selector knative.dev/crd-install=true \
   --filename https://github.com/knative/serving/releases/download/v0.8.0/serving.yaml \
   --filename https://github.com/knative/eventing/releases/download/v0.8.0/release.yaml \
   --filename https://github.com/knative/serving/releases/download/v0.8.0/monitoring.yaml
  1. To complete the install of Knative and its dependencies, run the kubectl apply command again, this time without the --selector flag, to complete the install of Knative and its dependencies:
   kubectl apply --filename https://github.com/knative/serving/releases/download/v0.8.0/serving.yaml \
   --filename https://github.com/knative/eventing/releases/download/v0.8.0/release.yaml \
   --filename https://github.com/knative/serving/releases/download/v0.8.0/monitoring.yaml
  1. Monitor the Knative components until all of the components show a STATUS of Running:
   kubectl get pods --namespace knative-serving
   kubectl get pods --namespace knative-eventing
   kubectl get pods --namespace knative-monitoring

Deploying an app

Now that your cluster has Knative installed, you’re ready to deploy an app.

If you’d like to follow a step-by-step guide for deploying your first app on Knative, check out the Getting Started with Knative App Deployment guide.

If you’d like to view the available sample apps and deploy one of your choosing, head to the sample apps repo.

Note: When looking up the IP address to use for accessing your app, you need to look up the NodePort for the istio-ingressgateway well as the IP address used for Minikube. You can use the following command to look up the value to use for the {IP_ADDRESS} placeholder used in the samples:

# In Knative 0.2.x and prior versions, the `knative-ingressgateway` service was used instead of `istio-ingressgateway`.
INGRESSGATEWAY=knative-ingressgateway

# The use of `knative-ingressgateway` is deprecated in Knative v0.3.x.
# Use `istio-ingressgateway` instead, since `knative-ingressgateway`
# will be removed in Knative v0.4.
if kubectl get configmap config-istio -n knative-serving &> /dev/null; then
    INGRESSGATEWAY=istio-ingressgateway
fi

echo $(minikube ip):$(kubectl get svc $INGRESSGATEWAY --namespace istio-system --output 'jsonpath={.spec.ports[?(@.port==80)].nodePort}')

Cleaning up

Delete the Kubernetes cluster along with Knative, Istio, and any deployed apps:

minikube delete