Skip to content

Commit

Permalink
Update current feature
Browse files Browse the repository at this point in the history
  • Loading branch information
fjammes committed Jun 19, 2024
1 parent b6b9f99 commit 6b83eed
Show file tree
Hide file tree
Showing 5 changed files with 151 additions and 2 deletions.
27 changes: 27 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: ''
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Operator Logs**
```
<Paste the logs here>
<Run `kubectl logs -l name=xrootd-operator` to get the logs>
```
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: "Integration tests"
on:
push:
pull_request:
branches:
- master
jobs:
main:
name: Run k8s advanced exercices
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Stop apparmor
run: |
sudo /etc/init.d/apparmor stop
- uses: actions/setup-go@v3
with:
go-version: '^1.19.2'
- name: Create k8s/kind cluster
run: |
go install github.com/k8s-school/[email protected]
ktbx create -c
- name: Install ink
run: |
go install github.com/k8s-school/[email protected]
- name: Install prometheus
run: |
./install.sh
53 changes: 51 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,51 @@
# demo-prometheus
Demo for prometheus installation on Kubernetes
# Pre-requisite

An up and running k8s cluster

NOTE: Successfully tested on kind-v0.6.1 (2020-01-10) and helm-v3.0.1

# Ex1: Install prometheus-operator

```shell
./install.sh

# Prometheus access:
kubectl port-forward -n monitoring prometheus-prometheus-stack-kube-prom-prometheus-0 9090

# Grafana access:
# login as admin with password prom-operator
kubectl port-forward $(kubectl get pods --selector=app.kubernetes.io/name=grafana -n monitoring --output=jsonpath="{.items..metadata.name}") -n monitoring 3000 &

# Alertmanager UI access
kubectl port-forward -n monitoring svc/alertmanager-operated 9093:9093

```



# Ex2: Install metric-server

NOTE: Successfully tested on kind-v0.6.1 (2020-01-10)

Enable 'kubectl top' command and hpa.

```shell

# See https://github.com/kubernetes-incubator/metrics-server
wget https://github.com/kubernetes-sigs/metrics-server/releases/download/v0.3.7/components.yaml

# Allow insecure tls, because of self-signed certificate
diff -u2 components.yaml.1 components.yaml
--- components.yaml.1 2020-08-25 09:20:38.000000000 +0200
+++ components.yaml 2020-09-22 23:46:05.873971737 +0200
@@ -89,4 +89,5 @@
- --cert-dir=/tmp
- --secure-port=4443
+ - --kubelet-insecure-tls
ports:
- name: main-port

# Create metrics-server and wait for it to work
kubectl apply -f components.yaml
```

26 changes: 26 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#!/bin/bash

## Install prometheus stack

set -euxo pipefail

DIR=$(cd "$(dirname "$0")"; pwd -P)

NS="monitoring"

# TODO hack, implement nicely helm delete
helm delete prometheus-stack -n monitoring || echo "Unable to delete prometheus stack"

kubectl delete ns -l name="$NS"
kubectl create namespace "$NS"
kubectl label ns "$NS" "name=$NS"

helm repo add prometheus-community https://prometheus-community.github.io/helm-charts || echo "Unable to add repo prometheus-community"
helm repo add stable https://charts.helm.sh/stable --force-update
helm repo update
helm install --version "45.27.2" prometheus-stack prometheus-community/kube-prometheus-stack -n monitoring -f "$DIR"/values.yaml --create-namespace

echo "Exercice: access prometheus-grafana and other services using the website documentation"
echo "1. Watch all pod in monitoring namespace"
echo "2. Retrieve grafana password using 'helm show values prometheus-community/kube-prometheus-stack'"
echo "3. Port forward grafana and access it in a web browser"
18 changes: 18 additions & 0 deletions values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

## Deploy a Prometheus instance
##
prometheus:
prometheusSpec:
## Prometheus StorageSpec for persistent data
## ref: https://github.com/prometheus-operator/prometheus-operator/blob/main/Documentation/user-guides/storage.md
##
storageSpec:
## Using PersistentVolumeClaim
##
volumeClaimTemplate:
spec:
accessModes: ["ReadWriteOnce"]
resources:
requests:
storage: 50Gi

0 comments on commit 6b83eed

Please sign in to comment.