Skip to content

Instantly share code, notes, and snippets.

@jewzaam
Last active July 28, 2023 16:00
Show Gist options
  • Save jewzaam/5f9f3a7f9131ad58b274c0dd3458a752 to your computer and use it in GitHub Desktop.
Save jewzaam/5f9f3a7f9131ad58b274c0dd3458a752 to your computer and use it in GitHub Desktop.
CMO scrape metrics
apiVersion: apps/v1
kind: Deployment
metadata:
name: metrics-load-test
namespace: metrics-load-test
spec:
replicas: 5
selector:
matchLabels:
name: metrics-load-test
template:
metadata:
labels:
name: metrics-load-test
spec:
automountServiceAccountToken: false
containers:
- name: metrics-load-test
image: quay.io/prometheuscommunity/avalanche:main
command:
- /bin/avalanche
args:
- --metric-count=1000
- --label-count=10
- --series-count=10
imagePullPolicy: Always
securityContext:
allowPrivilegeEscalation: false
seccompProfile:
type: RuntimeDefault
capabilities:
drop:
- ALL
runAsNonRoot: true
apiVersion: v1
kind: Namespace
metadata:
labels:
openshift.io/cluster-monitoring: 'true'
name: metrics-load-test
spec: {}
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: prometheus-k8s
namespace: metrics-load-test
rules:
- apiGroups:
- ''
resources:
- services
- endpoints
- pods
verbs:
- get
- list
- watch
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: prometheus-k8s
namespace: metrics-load-test
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: prometheus-k8s
namespace: metrics-load-test
subjects:
- kind: ServiceAccount
name: prometheus-k8s
namespace: openshift-monitoring
apiVersion: v1
kind: Service
metadata:
labels:
name: metrics-load-test
name: metrics-load-test
namespace: metrics-load-test
spec:
internalTrafficPolicy: Cluster
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
ports:
# use same port and targetPort so you can't flub it
- name: metrics
port: 9001
protocol: TCP
# targetPort is the port on the pod..
targetPort: 9001
selector:
name: metrics-load-test
sessionAffinity: None
type: ClusterIP
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
name: metrics-load-test
name: metrics-load-test
namespace: metrics-load-test
spec:
endpoints:
- bearerTokenSecret:
key: ''
port: metrics
namespaceSelector: {}
selector:
matchLabels:
name: metrics-load-test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment