privateBin/README.md

118 lines
3.1 KiB
Markdown
Raw Permalink Normal View History

# K8s PrivateBin Deployment
2024-12-28 18:51:04 +01:00
This repository contains Kubernetes manifests for deploying **PrivateBin**, an
open-source minimalist, encrypted pastebin, into a Kubernetes cluster. The
deployment is configured with Persistent Volumes, namespaces, services, and
ingress for external access.
## Project Structure
The project consists of the following Kubernetes YAML manifests:
- **00-namespace.yaml**: Specifies the namespace for isolating the PrivateBin
deployment.
- **01-pvc.yaml**: Configures the Persistent Volume Claim (PVC) to store
PrivateBin data persistently.
- **02-deployments.yaml**: Contains the deployment configuration for the
PrivateBin pod(s).
- **03-service.yaml**: Defines the service for exposing the deployment
internally within the cluster.
- **04-ingress.yaml**: Configures the ingress resource for routing external
traffic to the PrivateBin service.
## Prerequisites
Before deploying this project, ensure the following are already set up:
1. A Kubernetes cluster (e.g., Minikube, AKS, GKE, EKS, etc.).
2. `kubectl` CLI configured to interact with your cluster.
3. An ingress controller installed in your cluster (e.g., NGINX/Traefik).
## Deployment Instructions
Follow the steps below to deploy PrivateBin:
### 1. Clone the Repository
```bash
git clone https://git.van-hemmen.com/GuillaumeHemmen-k8s/privateBin.git
cd privateBin
```
### 2. Apply Kubernetes Manifests
Run the following commands to apply the manifests sequentially:
```bash
# Step 1: Create the namespace
kubectl apply -f 00-namespace.yaml
# Step 2: Apply Persistent Volume Claim
kubectl apply -f 01-pvc.yaml
# Step 3: Deploy PrivateBin
kubectl apply -f 02-deployments.yaml
# Step 4: Apply Service configuration
kubectl apply -f 03-service.yaml
# Step 5: Configure Ingress
kubectl apply -f 04-ingress.yaml
```
### 3. Verify the Deployment
- Check if all pods are running:
```bash
kubectl get pods -n privatebin
```
- Check the ingress details:
```bash
kubectl get ingress -n privatebin
```
### 4. Access PrivateBin
- Access your PrivateBin instance using the URL configured in the
`04-ingress.yaml` file. Ensure the DNS or host settings are properly
configured to route traffic appropriately.
## Customization
### Modify Namespace
If needed, update the namespace in each `.yaml` file to match your cluster's
organization.
### Update Ingress Configuration
Set your desired domain or hostname in `04-ingress.yaml` under the `host` field.
### Persistent Volume Storage Class
Update the `storageClassName` in `01-pvc.yaml` if necessary to match your
cluster's storage configuration.
## Cleanup
To remove the deployment, run:
```bash
kubectl delete -f 04-ingress.yaml
kubectl delete -f 03-service.yaml
kubectl delete -f 02-deployments.yaml
kubectl delete -f 01-pvc.yaml
kubectl delete -f 00-namespace.yaml
```
## Notes
- Ensure ingress is properly configured, as it is dependent on your cluster's
ingress controller setup.
- Persistent storage is configured to ensure your data is kept even if the pod
restarts.
## License
This project is licensed under the [MIT License](LICENSE).