<commit_before># Getting Started with nuclio on Kubernetes

Follow this step-by-step guide to set up a nuclio development environment that uses a Kubernetes cluster.

#### In this document

- [Install Kubernetes](#install-kubernetes)
- [Install nuclio](#install-nuclio)
- [Deploy a function with the nuclio playground](#deploy-a-function-with-the-nuclio-playground)
- [Deploy a function with the nuclio CLI (nuctl)](#deploy-a-function-with-the-nuclio-cli-nuctl)

## Install Kubernetes

To start deploying functions, you need a [Kubernetes](https://kubernetes.io) **v1.7 or later** cluster; nuclio uses Custom Resource Definitions (CRDs), which were introduced in Kubernetes v1.7. You can prepare the cluster in one of three ways:

1. [Using Minikube on a local virtual machine (VM)](/docs/setup/k8s/install/k8s-install-minikube.md).
   This method is recommended for beginners.
2. [From scratch, using kubeadm on Linux Ubuntu](/docs/setup/k8s/install/k8s-install-kubeadm-linux.md).
3. [On an existing Kubernetes cluster](/docs/setup/k8s/install/k8s-install-w-existing-cluster.md).

> **Note:** For simplicity, this guide assumes that you are using Minikube. If you select to use another method, simply replace `$(minikube ip)` references in the commands with your cluster IP.

## Install nuclio

After following your selected Kubernetes installation instructions, you should have a functioning Kubernetes cluster, a Docker registry, and a working local Kubernetes CLI (`kubectl`). Now, you can go ahead and install the nuclio services on the cluster:

```sh
kubectl apply -f https://raw.githubusercontent.com/nuclio/nuclio/master/hack/k8s/resources/controller.yaml
kubectl apply -f https://raw.githubusercontent.com/nuclio/nuclio/master/hack/k8s/resources/playground.yaml
```

Use the command `kubectl get pods` to verify that both the controller and playground have a status of `Running`. For more information about `kubectl`, see the [Kubernetes documentation](https://kubernetes.io/docs/user-guide/kubectl-overview/).

## Deploy a function with the nuclio playground

Browse to `http://$(minikube ip):32050`.
You should be greeted by the [nuclio playground](/README.md#playground). 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.<commit_msg>Update k8s setup docs (#514)<commit_after># Getting Started with nuclio on Kubernetes

Follow this step-by-step guide to set up a nuclio development environment that uses a Kubernetes cluster.

#### In this document

- [Prepare Kubernetes](#prepare-kubernetes)
- [Install nuclio](#install-nuclio)
- [Deploy a function with the nuclio playground](#deploy-a-function-with-the-nuclio-playground)
- [Deploy a function with the nuclio CLI (nuctl)](#deploy-a-function-with-the-nuclio-cli-nuctl)

## Prepare Kubernetes

To start deploying functions, you need a [Kubernetes](https://kubernetes.io) **v1.7 or later** cluster and access to a Docker registry.

### Minikube
If you're just getting started with Kubernetes, we recommend following our [Minikube installation guide](/docs/setup/k8s/install/k8s-install-minikube.md) before continuing. It will walk you through installing a Kubernetes cluster on a local VM with a built in Docker registry.

### Managed Kubernetes
If you're using a managed Kubernetes cluster like [GKE](/docs/setup/gke/getting-started-gke.md) or AKS (coming soon), head on over to the specific guide for that platform, including leveraging the private Docker registries. 

### Self hosted
If you already have a Kubernetes v1.7+ cluster, you just need to make sure you have access to some Docker registry. If you'd like to use the docker hub, specify `--registry <your account name>` in `nuctl deploy` (omitting `--run-registry`). Otherwise, specify the address of the private Docker registry (e.g. `--registry 10.0.0.1:8989`). The docker daemon must be authenticated to this registry on the machine running `nuctl`.

To use the `nuclio` playground, follow [GKE's playground section](/docs/setup/gke/getting-started-gke.md#deploy-a-function-with-the-nuclio-playground) on how to inject Docker credentials into the `nuclio` playground (documentation about this is coming soon).

> **Note:** For simplicity, this guide assumes that you are using Minikube. If you select to use another method, replace `$(minikube ip)` references in the commands with your cluster IP.

## Install nuclio

After following your selected Kubernetes installation instructions, you should have a functioning Kubernetes cluster, a Docker registry, and a working local Kubernetes CLI (`kubectl`). Now, you can go ahead and install the nuclio services on the cluster:

```sh
kubectl apply -f https://raw.githubusercontent.com/nuclio/nuclio/master/hack/k8s/resources/controller.yaml
kubectl apply -f https://raw.githubusercontent.com/nuclio/nuclio/master/hack/k8s/resources/playground.yaml
```

Use the command `kubectl get pods` to verify that both the controller and playground have a status of `Running`. For more information about `kubectl`, see the [Kubernetes documentation](https://kubernetes.io/docs/user-guide/kubectl-overview/).

## Deploy a function with the nuclio playground

Browse to `http://$(minikube ip):32050`.
You should be greeted by the [nuclio playground](/README.md#playground). 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.
{'fraction_non_alphanumeric': 0.09393887066137109, 'fraction_numerical': 0.007943360386807114, 'mean_word_length': 4.89816700610998, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 6, 'https://': 8, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4609957', 'n_tokens_mistral': 1724, 'n_tokens_neox': 1605, 'n_words': 688}