Skip to content

Instantly share code, notes, and snippets.

@ikurni
ikurni / nodeSelector.config
Last active May 5, 2022 03:57
Schedule a POD to specific node
https://access.redhat.com/solutions/2178611
### How to Force a pod to schedule to a specific node using nodeSelector in OCP
Pods get scheduled to nodes based on the node labels. NodeSelector will get set either for the cluster, project, or pod to determine which node or group of nodes the pod will be scheduled to.
The easiest way to test and ensure a pod is scheduled to a node is by setting it at the project level. This can only be done by cluster-admins or users with elevated privileges.
# oc adm project <NAME> --node-selector='foo=bar'
@ikurni
ikurni / master-config.yaml
Last active April 27, 2018 09:22
Master config with LDAP Provider
oauthConfig:
assetPublicURL: https://ocpmaster.example.com:8443/console/
grantConfig:
method: auto
identityProviders:
#- challenge: true
# login: true
# mappingMethod: claim
# name: allow_all
# provider:
@ikurni
ikurni / es_health_check.sh
Last active March 20, 2018 04:02
Troubleshoot Logging for OCP
#!/bin/bash
oc project logging
anypod=$(oc get po --selector=component=es --no-headers -o jsonpath='{range .items[?(@.status.phase=="Running")]}{.metadata.name}{"\n"}{end}' | head -n1)
ES_URL='https://localhost:9200'
curl_get='curl -s -X GET --cacert /etc/elasticsearch/secret/admin-ca --cert /etc/elasticsearch/secret/admin-cert --key /etc/elasticsearch/secret/admin-key'
date
$curl_get $ES_URL/_cat/health?v
# See https://www.elastic.co/guide/en/elasticsearch/reference/2.4/cat-nodes.html for header meanings
@ikurni
ikurni / preparation-hosts.yml
Last active October 16, 2018 23:30
OCP hosts preparation before installation - for Docker 1.12
---
- hosts: clients
tasks:
- name: Install additional packages needed
yum:
name: "{{ item }}"
state: latest
with_items:
- wget
- git
@ikurni
ikurni / ocp-health-check.yaml
Created March 2, 2018 07:22
OCP Health Check
---
- hosts: clients
tasks:
- name: Check Swap, make sure it's off
shell: ansible nodes -m shell -a 'free -m | grep "^Swap"'
- name: Check Kubelet Config
shell: ansible nodes -m shell -a 'grep -A10 "^kubeletArguments" /etc/origin/node/node-config.yaml'
- name: Selinux Status
@ikurni
ikurni / ocp-post-install.yaml
Created March 2, 2018 12:19
OCP Post Install scripts
---
- name: perform postinstallation steps
hosts: masters[0]
tasks:
- block:
- name: create yaml for cassandra pv
copy:
content: |
apiVersion: v1
kind: PersistentVolume
@ikurni
ikurni / aci-containers.yaml
Created March 13, 2018 08:03
ACI containers file for automatic deploy CNI
apiVersion: v1
kind: ConfigMap
metadata:
name: aci-containers-config
namespace: kube-system
labels:
aci-containers-config-version: "ac19175f-667f-4bf7-8b2c-4e6ed07802cd"
network-plugin: aci-containers
data:
controller-config: |-
@ikurni
ikurni / ds-aci-containers-host
Created March 13, 2018 08:50
Daemon Set ACI Container hosts
apiVersion: extensions/v1beta1
kind: DaemonSet
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{"apiVersion":"extensions/v1beta1","kind":"DaemonSet","metadata":{"annotations":{},"labels":{"aci-containers-config-version":"ac19175f-667f-4bf7-8b2c-4e6ed07802cd","network-plugin":"aci-containers"},"name":"aci-containers-host","namespace":"kube-system"},"spec":{"template":{"metadata":{"annotations":{"scheduler.alpha.kubernetes.io/critical-pod":""},"labels":{"name":"aci-containers-host","network-plugin":"aci-containers"}},"spec":{"containers":[{"env":[{"name":"KUBERNETES_NODE_NAME","valueFrom":{"fieldRef":{"fieldPath":"spec.nodeName"}}}],"image":"noiro/aci-containers-host:1.6r15","imagePullPolicy":"Always","livenessProbe":{"httpGet":{"path":"/status","port":8090}},"name":"aci-containers-host","securityContext":{"capabilities":{"add":["SYS_ADMIN","NET_ADMIN"]},"privileged":true},"volumeMounts":[{"mountPath":"/mnt/cni-bin","name":"cni-bin"},{"mountPath":"/mnt/cni-conf","name":"cn
#
# ansible inventory for OpenShift Container Platform 3.11.16
# AgnosticD ansible-config: ocp-ha-lab
[OSEv3:vars]
###########################################################################
### Ansible Vars
###########################################################################
timeout=60
@ikurni
ikurni / preparation-host.yml
Created October 16, 2018 23:32
OCP hosts preparation scripts - docker 1.13 above
---
- hosts: clients
tasks:
- name: Install additional packages needed
yum:
name: "{{ item }}"
state: latest
with_items:
- wget
- git