--- Title: 'How to set up a local Knative environment with KinD and without DNS headaches' Author: Leon Stigter Author handle: https://twitter.com/retgits Date: '' Description: A how-to guide to deploy Knative, Kourier, and your first app on top of a Kubernetes cluster. Folder with media files: 'N/A' Blog URL: '' Labels: Articles Reviewers: '' --- | Reviewer | Date | Approval | | ------------- | ------------- | ------------- | | @retgits | 2020-06-03 |:+1:| | | | | Knative builds on Kubernetes to abstract away complexity for developers, and enables them to focus on delivering value to their business. The complex (and sometimes boring) parts of building apps to run on Kubernetes are managed by Knative. In this post, we will focus on setting up a lightweight environment to help you to develop modern apps faster using Knative. ## Step 1: Setting up your Kubernetes deployment using KinD There are many options for creating a Kubernetes cluster on your local machine. However, since we are running containers in the Kubernetes cluster anyway, let’s also use containers for the cluster itself. Kubernetes IN Docker, or _KinD_ for short, enables developers to spin up a Kubernetes cluster where each cluster node is a container. You can install KinD on your machine by running the following commands: ```bash curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.8.1/kind-$(uname)-amd64 chmod +x ./kind mv ./kind /some-dir-in-your-PATH/kind ``` Next, create a Kubernetes cluster using KinD, and expose the ports the ingress gateway to listen on the host. To do this, you can pass in a file with the following cluster configuration parameters: ```bash cat > clusterconfig.yaml < 80:31080/TCP,443:31443/TCP 87m ``` ```bash $ docker ps -a ``` ```bash CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES d53c275d7461 kindest/node:v1.18.2 "/usr/local/bin/entr…" 4 hours ago Up 4 hours 127.0.0.1:49350->6443/tcp, 0.0.0.0:80->31080/tcp, 0.0.0.0:443->31443/tcp knative-control-plane ``` The ports, and how they’re tied to the host, should be the same as you’ve defined in the clusterconfig file. For example, port 31380 in the cluster is exposed as port 80. ## Step 4: Deploying your first app Now that the cluster, Knative, and the networking components are ready, you can deploy an app. The straightforward [Go app](https://knative.dev/docs/eventing/samples/helloworld/helloworld-go/) that already exists, is an excellent example app to deploy. The first step is to create a yaml file with the hello world service definition: ```bash cat > service.yaml <