Deploy the PDP on Kubernetes with Pulumi
Install the Permit.io policy decision point (PDP) on Kubernetes with Pulumi. This page is for operators who manage cluster workloads with Pulumi in Python.
The Pulumi example in the permit-pdp-deployments-examples repository is a Python program (__main__.py). The program creates a pdp namespace and installs the PDP Helm chart into it as a release named pdp. The chart creates a Deployment, a Service, and a Secret, all named with the permitio-pdp prefix. For what the chart installs, see Deploy the PDP on Kubernetes with Helm.
Prerequisites
- A Kubernetes cluster, and a kubeconfig that Pulumi can use.
- The Pulumi CLI and Python 3 installed.
- Git installed.
- Your environment API key. See Get your API key.
Install the PDP with Pulumi
- Clone the deployment examples repository:
git clone https://github.com/permitio/permit-pdp-deployments-examples
- Change to the
pulumidirectory of the cloned repository:
cd permit-pdp-deployments-examples/pulumi
- Create a Pulumi Python project and stack in the directory. The directory isn't empty, so
pulumi newneeds--force, which replaces__main__.pywith the template's file. These commands keep a copy of the example's__main__.pyand restore it. Thekubernetes-pythontemplate addspulumi-kubernetes, which the program imports, torequirements.txt:
cp __main__.py /tmp/permit-pdp-main.py
pulumi new kubernetes-python --force
cp /tmp/permit-pdp-main.py __main__.py
- Store your environment API key as an encrypted Pulumi secret. Replace
<YOUR_API_KEY>with the key. The program reads the key from theapiKeyconfig value:
pulumi config set --secret apiKey <YOUR_API_KEY>
- Preview and deploy the resources. Select
yesto confirm:
pulumi up
The program installs the chart from https://permitio.github.io/sidecar, which no longer serves a Helm repository. Change repo in __main__.py to https://permitio.github.io/PDP.
Verify the PDP is running
- Run
kubectl get pods -n pdp. Thepermitio-pdppod showsRunningin theSTATUScolumn. - Run
kubectl port-forward svc/permitio-pdp 7766:7766 -n pdp, then send aGETrequest tohttp://localhost:7766/health. A healthy PDP returns HTTP200with"status": "ok".
Connect to the PDP
Inside the cluster, the PDP is at http://permitio-pdp.pdp.svc.cluster.local:7766. To reach the PDP from outside the cluster, expose the permitio-pdp Service. See Connect to the PDP.