mirror of
https://github.com/philippemerle/KubeDiagrams.git
synced 2026-08-16 14:16:14 +00:00
Add support for deploying the webapp in a Kubernetes cluster
This commit is contained in:
@@ -10,6 +10,7 @@ A modern web application for generating Kubernetes architecture diagrams from ma
|
||||
- **Built-in Examples**: Pre-loaded examples for quick testing
|
||||
- **History Management**: Keep track of your diagram generations
|
||||
- **Docker Support**: Easy deployment with Docker and Docker Compose
|
||||
- **Kubernetes Support**: Easy deployment on Kubernetes clusters
|
||||
- **Access Logging**: Apache Combined Log format compatible with GoAccess
|
||||
|
||||
---
|
||||
@@ -43,6 +44,37 @@ That's it! The application is now running with both frontend and backend service
|
||||
docker compose down
|
||||
```
|
||||
|
||||
### Using Minikube
|
||||
|
||||
#### 1. **Clone the repository**
|
||||
|
||||
```bash
|
||||
git clone https://github.com/philippemerle/KubeDiagrams.git
|
||||
cd KubeDiagrams/webapp
|
||||
```
|
||||
|
||||
#### 2. **Start the application**
|
||||
|
||||
```bash
|
||||
kubectl apply -f kubernetes/kube-diagrams-webapp.yaml
|
||||
```
|
||||
|
||||
#### 3. **Access the application**
|
||||
|
||||
It is needed to expose the frontend service.
|
||||
|
||||
```bash
|
||||
minikube service -n kube-diagrams frontend
|
||||
```
|
||||
|
||||
That's it! A new tab is opened in your default browser to access the KubeDiagrams WebApp frontend.
|
||||
|
||||
#### Stopping the application
|
||||
|
||||
```bash
|
||||
kubectl delete -f kubernetes/kube-diagrams-webapp.yaml
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
@@ -121,6 +153,10 @@ webapp/
|
||||
│ ├── apache.conf # Apache reverse proxy config
|
||||
│ └── Dockerfile # Frontend Docker image
|
||||
│
|
||||
├── kubernetes/ # Kubernetes orchestration
|
||||
└── kube-diagrams-webapp.yaml # Manifests for deploying KubeDiagrams WebApp
|
||||
│
|
||||
├── build-and-push-images.sh # Script to build and push both frontend and backend container images
|
||||
└── docker-compose.yml # Docker Compose orchestration
|
||||
```
|
||||
|
||||
|
||||
@@ -0,0 +1,137 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: kube-diagrams
|
||||
labels:
|
||||
app.kubernetes.io/name: KubeDiagrams
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: frontend
|
||||
namespace: kube-diagrams
|
||||
labels:
|
||||
app.kubernetes.io/name: KubeDiagrams
|
||||
app.kubernetes.io/component: frontend
|
||||
spec:
|
||||
ports:
|
||||
- port: 80
|
||||
name: http
|
||||
selector:
|
||||
app.kubernetes.io/name: KubeDiagrams
|
||||
app.kubernetes.io/component: frontend
|
||||
type: LoadBalancer
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: frontend
|
||||
namespace: kube-diagrams
|
||||
labels:
|
||||
app.kubernetes.io/name: KubeDiagrams
|
||||
app.kubernetes.io/component: frontend
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: KubeDiagrams
|
||||
app.kubernetes.io/component: frontend
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: KubeDiagrams
|
||||
app.kubernetes.io/component: frontend
|
||||
spec:
|
||||
containers:
|
||||
- image: philippemerle/kubediagrams-frontend:latest
|
||||
name: frontend
|
||||
env:
|
||||
- name: BACKEND_URL
|
||||
value: http://backend:5000
|
||||
ports:
|
||||
- containerPort: 80
|
||||
name: http
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: backend
|
||||
namespace: kube-diagrams
|
||||
labels:
|
||||
app.kubernetes.io/name: KubeDiagrams
|
||||
app.kubernetes.io/component: backend
|
||||
spec:
|
||||
ports:
|
||||
- port: 5000
|
||||
selector:
|
||||
app.kubernetes.io/name: KubeDiagrams
|
||||
app.kubernetes.io/component: backend
|
||||
type: LoadBalancer
|
||||
---
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: backend
|
||||
namespace: kube-diagrams
|
||||
labels:
|
||||
app.kubernetes.io/name: KubeDiagrams
|
||||
app.kubernetes.io/component: backend
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app.kubernetes.io/name: KubeDiagrams
|
||||
app.kubernetes.io/component: backend
|
||||
strategy:
|
||||
type: Recreate
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app.kubernetes.io/name: KubeDiagrams
|
||||
app.kubernetes.io/component: backend
|
||||
spec:
|
||||
serviceAccountName: backend
|
||||
containers:
|
||||
- image: philippemerle/kubediagrams-backend:latest
|
||||
name: backend
|
||||
ports:
|
||||
- containerPort: 5000
|
||||
name: backend
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: backend
|
||||
namespace: kube-diagrams
|
||||
labels:
|
||||
app.kubernetes.io/name: KubeDiagrams
|
||||
app.kubernetes.io/component: backend
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: kube-diagrams
|
||||
labels:
|
||||
app.kubernetes.io/name: KubeDiagrams
|
||||
app.kubernetes.io/component: backend
|
||||
subjects:
|
||||
- apiGroup: ""
|
||||
kind: ServiceAccount
|
||||
name: backend
|
||||
namespace: kube-diagrams
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: kube-diagrams
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: kube-diagrams
|
||||
labels:
|
||||
app.kubernetes.io/name: KubeDiagrams
|
||||
app.kubernetes.io/component: backend
|
||||
rules:
|
||||
- apiGroups: ["*"]
|
||||
resources: ["*"]
|
||||
verbs: ["*"]
|
||||
Reference in New Issue
Block a user