Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/python-web-app/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM ubuntu
FROM ubuntu:24.04

WORKDIR /app

Expand Down
6 changes: 6 additions & 0 deletions examples/python-web-app/cm.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: test-cm
data:
db-port: "3310"
19 changes: 19 additions & 0 deletions examples/python-web-app/custom_kube_prometheus_stack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
alertmanager:
alertmanagerSpec:
# Selects Alertmanager configuration based on these labels. Ensure that the Alertmanager configuration has matching labels.
# ✅ Solves error: Misconfigured Alertmanager selectors can lead to missing alert configurations.
# ✅ Solves error: Alertmanager wasn't able to findout the applied CRD (kind: Alertmanagerconfig)
alertmanagerConfigSelector:
matchLabels:
release: monitoring

# Sets the number of Alertmanager replicas to 3 for high availability.
# ✅ Solves error: Single replica can cause alerting issues during pod failures.
# ✅ Solves error: Alertmanager Cluster Status is Disabled (GitHub issue)
replicas: 2

# Sets the strategy for matching Alertmanager configurations. 'None' means no specific matching strategy.
# ✅ Solves error: Incorrect matcher strategy can lead to unhandled alert configurations.
# ✅ Solves error: Get rid of namespace matchers when creating AlertManagerConfig (GitHub issue)
alertmanagerConfigMatcherStrategy:
type: None
29 changes: 29 additions & 0 deletions examples/python-web-app/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: python-deployment
labels:
app: sample-python-app
spec:
replicas: 2
selector:
matchLabels:
app: sample-python-app
template:
metadata:
labels:
app: sample-python-app
spec:
containers:
- name: sample-python-app
image: wasimakram0028/django-web-app:latest
volumeMounts:
- name: foo
mountPath: "/opt"
ports:
- containerPort: 8000
volumes:
- name: foo
secret:
secretName: secret-basic-auth

10 changes: 10 additions & 0 deletions examples/python-web-app/extra.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Get Grafana 'admin' user password by running:

kubectl --namespace monitoring get secrets monitoring-grafana -o jsonpath="{.data.admin-password}" | base64 -d ; echo

Access Grafana local instance:

export POD_NAME=$(kubectl --namespace monitoring get pod -l "app.kubernetes.io/name=grafana,app.kubernetes.io/instance=monitoring" -oname)
kubectl --namespace monitoring port-forward $POD_NAME 3000

Visit https://github.com/prometheus-operator/kube-prometheus for instructions on how to create & configure Alertmanager and Prometheus instances using the Operator.
8 changes: 8 additions & 0 deletions examples/python-web-app/secrets.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
apiVersion: v1
kind: Secret
metadata:
name: secret-basic-auth
type: kubernetes.io/basic-auth
stringData:
username: admin # required field for kubernetes.io/basic-auth
password: t0p-Secret # required field for kubernetes.io/basic-auth
12 changes: 12 additions & 0 deletions examples/python-web-app/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: python-django-service
spec:
type: LoadBalancer
selector:
app: sample-python-app
ports:
- port: 80
targetPort: 8000
nodePort: 30007