Skip to content

Latest commit

 

History

History
142 lines (101 loc) · 5.13 KB

Knative-with-Minikube.md

File metadata and controls

142 lines (101 loc) · 5.13 KB

Knative 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

Knative requires a Kubernetes cluster v1.10 or newer. If you don't have one, you can create one using Minikube.

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.10 or greater and your chosen VM driver:

For Linux use:

minikube start --memory=8192 --cpus=4 \
  --kubernetes-version=v1.11.3 \
  --vm-driver=kvm2 \
  --bootstrapper=kubeadm \
  --extra-config=apiserver.enable-admission-plugins="LimitRanger,NamespaceExists,NamespaceLifecycle,ResourceQuota,ServiceAccount,DefaultStorageClass,MutatingAdmissionWebhook"

For macOS use:

minikube start --memory=8192 --cpus=4 \
  --kubernetes-version=v1.11.3 \
  --vm-driver=hyperkit \
  --bootstrapper=kubeadm \
  --extra-config=apiserver.enable-admission-plugins="LimitRanger,NamespaceExists,NamespaceLifecycle,ResourceQuota,ServiceAccount,DefaultStorageClass,MutatingAdmissionWebhook"

Installing Istio

Knative depends on Istio. Run the following to install Istio. (We are changing LoadBalancer to NodePort for the istio-ingress service).

curl -L https://raw.githubusercontent.com/knative/serving/v0.1.1/third_party/istio-0.8.0/istio.yaml \
  | sed 's/LoadBalancer/NodePort/' \
  | kubectl apply --filename -

# Label the default namespace with istio-injection=enabled.
kubectl label namespace default istio-injection=enabled

Monitor the Istio components until all of the components show a STATUS of Running or Completed:

kubectl get pods --namespace istio-system

It will take a few minutes for all the components to be up and running; you can rerun the command to see the current status.

Note: Instead of rerunning the command, you can add --watch to the above command to view the component's status updates in real time. Use CTRL+C to exit watch mode.

Installing Knative Serving

Next, install Knative Serving:

Because you have limited resources available, use the https://github.com/knative/serving/releases/download/v0.1.1/release-lite.yaml file, which omits some of the monitoring components to reduce the memory used by the Knative components. To use the provided release-lite.yaml release, run:

curl -L https://github.com/knative/serving/releases/download/v0.1.1/release-lite.yaml \
  | sed 's/LoadBalancer/NodePort/' \
  | kubectl apply --filename -

Monitor the Knative components until all of the components show a STATUS of Running:

kubectl get pods --namespace knative-serving

Just as with the Istio components, it will take a few seconds for the Knative components to be up and running; you can rerun the command to see the current status.

Note: Instead of rerunning the command, you can add --watch to the above command to view the component's status updates in real time. Use CTRL+C to exit watch mode.

Now you can deploy an app to your newly created Knative cluster.

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 knative-ingressgateway as 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:

echo $(minikube ip):$(kubectl get svc knative-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

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License.