# Deploy on Kubernetes

Run Outpost on a local Kubernetes cluster using Minikube and Helm. This setup includes:

* Outpost services (API, Delivery, and Log)
* Redis for KV and entity storage
* PostgreSQL for log storage
* RabbitMQ for message queuing

## Prerequisites

* [Docker](https://docs.docker.com/engine/install/)
* [Minikube](https://minikube.sigs.k8s.io/docs/start)
* [kubectl](https://kubernetes.io/docs/tasks/tools/)
* [Helm](https://helm.sh/docs/intro/install/)

## Setup

1. Clone the Outpost repository:
  
  
  ```sh
  git clone https://github.com/hookdeck/outpost.git
  
  ```
  
  
2. Start Minikube and create a namespace:
  
  
  ```sh
  minikube start
  kubectl create namespace outpost
  kubectl config set-context --current --namespace=outpost
  
  ```
  
  
3. Install dependencies (Redis, PostgreSQL, RabbitMQ):
  
  
  ```sh
  cd outpost/examples/kubernetes
  ./setup-dependencies.sh
  
  ```
  
  
4. Install Outpost via Helm:
  
  
  ```sh
  helm install outpost ../../deployments/kubernetes/charts/outpost -f outpost.yaml
  
  ```
  
  

## Verify Installation

1. Enable ingress and start the tunnel (keep this terminal open):
  
  
  ```sh
  minikube addons enable ingress
  kubectl wait --namespace ingress-nginx \
    --for=condition=ready pod \
    --selector=app.kubernetes.io/component=controller \
    --timeout=90s
  sudo minikube tunnel
  
  ```
  
  
2. In a new terminal, add the local domain to `/etc/hosts`:
  
  
  ```sh
  echo "127.0.0.1 outpost.acme.local" | sudo tee -a /etc/hosts
  
  ```
  
  
3. Get your API key:
  
  
  ```sh
  export OUTPOST_API_KEY=$(kubectl get secret outpost-secrets \
    -o jsonpath='{.data.API_KEY}' | base64 -d)
  echo $OUTPOST_API_KEY
  
  ```
  
  
4. Create a tenant and verify the API:
  
  
  ```sh
  curl --request PUT 'http://outpost.acme.local/api/v1/hookdeck' \
    --header "Authorization: Bearer $OUTPOST_API_KEY"
  
  curl 'http://outpost.acme.local/api/v1/hookdeck' \
    --header "Authorization: Bearer $OUTPOST_API_KEY"
  
  ```
  
  

## Explore Further

Publish events and inspect delivery via the API or portal:

```sh
# Access Redis CLI
kubectl exec -it outpost-redis-master-0 -- redis-cli

# Access PostgreSQL
kubectl exec -it outpost-postgresql-0 -- psql -U outpost

# RabbitMQ Management UI at http://localhost:15672
kubectl port-forward outpost-rabbitmq-0 15672:15672

```

## Cleanup

```sh
kubectl delete namespace outpost
kubectl config set-context --current --namespace=default
sudo sed -i '' '/outpost.acme.local/d' /etc/hosts

```