Skip to content

Instantly share code, notes, and snippets.

@rvanbutselaar
rvanbutselaar / OpenShift Training
Last active October 10, 2018 09:55
OpenShift
minishift start --vm-driver virtualbox
# Openshift Cockpit
Monitoring tool??
# Routing layer pluggable and extensible if hardware or non-OpenShift software router desired
Haproxy / F5 LB
# Image stream
Laag voor Docker registries, met triggers bij image wijzigingen voor automatische deployments.
apiVersion: v1
items:
- kind: "BuildConfig"
apiVersion: "v1"
metadata:
name: "pipeline-demo"
spec:
triggers:
- github:
secret: 5Mlic4Le
https://docs.openshift.com/container-platform/3.10/install/prerequisites.html
Infrastructure nodes running in DMZ
Application hosting nodes, master, other supporting infrastructure running in more secure network
# diagnostics after installation
sudo oc adm diagnostics
ansible-playbook -i /root/my_ocp_inventory \
/usr/share/ansible/openshift-ansible/playbooks/byo/openshift-checks/health.yml
# Docker daemon
systemctl is-active docker
# Check that Docker volume group has adequate space
echo $(echo \"$(docker info 2>/dev/null | awk '/Data Space Available/ {print $4}') / $(docker info 2>/dev/null | awk '/Data Space Total/ {print $4}')\" | bc -l) '>' 0.3 | bc -l
# Check that Docker volume group has adequate metadata space
echo $(echo \"$(docker info 2>/dev/null | awk '/Metadata Space Available/ {print $4}') / $(docker info 2>/dev/null | awk '/Metadata Space Total/ {print $4}')\" | bc -l) '>' 0.3 | bc -l
# etcd is active
# Install OpenShift 3.11 cli
brew install https://raw.githubusercontent.com/cblecker/homebrew-core/d1092419e5113b296a6b1d7ecd2bf6673d39f0a2/Formula/openshift-cli.rb
# ID = /var/lib/origin/openshift.local.volumes/plugins/kubernetes.io/cinder/mounts/[ID]
oc get pv -o json | jq -r '[.items[] | {name:.spec.claimRef.name, namespace:.spec.claimRef.namespace, volumeID:.spec.cinder.volumeID}]' | grep -n2 [ID]
# ElasticSearch get incides
oc -n openshift-logging rsh $(oc -n openshift-logging get po -l component=es -o name) es_util --query=_cat/indices -XCURL
# detach volumes from server
openstack server show compute-1 -f value
for v in `cat volumes`; do openstack volume show $v; done
for v in `cat volumes`; do echo $v && openstack server remove volume compute-1 $v; done
# add security group
for s in `openstack server list -c Name -f value| grep "prod"`; do openstack server add security group $s allow-http; done
# list/show/delete available volumes
openstack volume list --status available -f value -c Name > available-vols.txt
@rvanbutselaar
rvanbutselaar / Vagrantfile
Created February 12, 2019 07:44
Vagrantfile with additional disks
# -*- mode: ruby -*-
# vi: set ft=ruby :
#
# cpu = # cpu per VM
cpu = 3
#
# mem = MB ram per VM
#
mem = 4096
- name: 3.6 - Get list of all PersistentVolumeClaim's
k8s_facts:
api_version: v1
kind: PersistentVolumeClaim
namespace: "{{ env }}"
label_selectors:
- orig != glusterfs-gluster01
host: "{{ openshift_api_url }}"
api_key: "{{ src_api_key }}"
verify_ssl: false
- hosts: "{{ src_server }}"
gather_facts: false
any_errors_fatal: true
- block
rescue:
- set_fact:
failed_play: true
delegate_to: "{{ item }}"
delegate_facts: yes
with_items:
@rvanbutselaar
rvanbutselaar / ssh to multiple servers
Created March 29, 2019 08:28
ssh to multiple servers
xpanes --ssh server-{1..3}