Skip to content

Instantly share code, notes, and snippets.

View ilackarms's full-sized avatar

ilackarms

View GitHub Profile

Deploy Prometheus

  1. Fresh OC Cluster
  2. On local machine (where you will be running ansible):
git clone https://github.com/openshift/openshift-ansible
cd openshift-ansible
# cherry-pick Zohar's PR which adds prometheus role
git remote add zgalor https://github.com/zgalor/openshift-ansible
git fetch zgalor
@ilackarms
ilackarms / manageiq_provider.yml
Created August 23, 2017 11:05
manageiq_provider.yml
#!/usr/bin/python
#
# (c) 2017, Daniel Korn <korndaniel1@gmail.com>
# 2017, Yaacov Zamir <yzamir@redhat.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#!/bin/bash
set -x
sudo pkill -x openshift
docker ps | awk 'index($NF,"k8s_")==1 { print $1 }' | xargs -l -r docker stop
mount | grep "openshift.local.volumes" | awk '{ print $3}' | xargs -l -r sudo umount
sudo rm -rf openshift.local.*
#!/bin/bash
set -x #-e
export PATH=${PATH}:${PWD}/_output/local/bin/linux/amd64
export KUBECONFIG=${PWD}/openshift.local.config/master/admin.kubeconfig
#make sure docker daemon starts with --insecure-registry 172.30.0.0/16
#check out /usr/lib/systemd/system/docker.service
sudo systemctl stop firewalld
sudo env "PATH=$PATH" openshift start > openshift.local.log 2>&1 &
sleep 5
sudo chmod +rw $KUBECONFIG
apiVersion: v1
kind: Template
metadata:
name: prometheus
annotations:
"openshift.io/display-name": Prometheus
description: |
A monitoring solution for an OpenShift cluster - collect and gather metrics from nodes, services, and the infrastructure.
iconClass: icon-cogs
tags: "monitoring,prometheus,time-series"
→ docker login -u foo -p $(oc serviceaccounts get-token builder) http://172.17.0.2:5000
Login Succeeded
→ docker push 172.17.0.2:5000/openshift/busyboxThe push refers to a repository [172.17.0.2:5000/openshift/busybox]
4ac76077f2c7: Preparing
unauthorized: authentication required
@ilackarms
ilackarms / kubeclient_test.rb
Created June 6, 2017 14:31
test script for kubeclient
require 'kubeclient'
kc = Kubeclient::Client.new("http://localhost:8001")
kc.discover
klass = "Kubeclient::Namespace".split('::').inject(Object) {|o,c| o.const_get c}
ns = kc.get_entities("namespaces", klass, "namespaces")
p ns
apiVersion: v1
kind: Template
metadata:
name: prometheus
parameters:
- description: The namespace to instantiate prometheus under. Defaults to 'default'.
name: NAMESPACE
value: default
objects:
- apiVersion: v1
Name: hawkular-cassandra-1-fvtg7
Namespace: openshift-infra
Security Policy: restricted
Node: localhost.localdomain/192.168.16.70
Start Time: Mon, 27 Mar 2017 15:54:36 -0400
Labels: metrics-infra=hawkular-cassandra
name=hawkular-cassandra-1
type=hawkular-cassandra
Status: Pending
IP:
W0327 15:47:03.509512 15791 start_master.go:291] Warning: assetConfig.loggingPublicURL: Invalid value: "": required to view aggregated container logs in the console, master start will continue.
W0327 15:47:03.509558 15791 start_master.go:291] Warning: assetConfig.metricsPublicURL: Invalid value: "": required to view cluster metrics in the console, master start will continue.
W0327 15:47:03.509565 15791 start_master.go:291] Warning: auditConfig.auditFilePath: Required value: audit can now be logged to a separate file, master start will continue.
I0327 15:47:03.512833 15791 logs.go:41] warning: ignoring ServerName for user-provided CA for backwards compatibility is deprecated
2017-03-27 15:47:03.513180 I | etcdserver/api/v3rpc: grpc: addrConn.resetTransport failed to create client transport: connection error: desc = "transport: dial tcp 192.168.16.70:4001: getsockopt: connection refused"; Reconnecting to {192.168.16.70:4001 <nil>}
I0327 15:47:03.513530 15791 logs.go:41] warning: ignoring ServerName fo