Skip to content

Instantly share code, notes, and snippets.

View ralvares's full-sized avatar
🏠
Working from home

Rodrigo Alvares ralvares

🏠
Working from home
  • My Own Repo :)
  • Dubai - AE
View GitHub Profile
@ralvares
ralvares / NTP - MCO
Last active March 16, 2021 03:50
ntp on ocp4
chronybase64=$(cat << EOF | base64 -w 0
server 0.fi.pool.ntp.org iburst
server 1.fi.pool.ntp.org iburst
server 2.fi.pool.ntp.org iburst
server 3.fi.pool.ntp.org iburst
driftfile /var/lib/chrony/drift
makestep 1.0 3
rtcsync
keyfile /etc/chrony.keys
leapsectz right/UTC
@ralvares
ralvares / ocp 4.6 and Custom Catalogs
Last active December 21, 2020 12:21
OCP 4.6 and Custom Catalogs
# CentOS 8 - Install Latest Podman
sudo dnf -y module disable container-tools
sudo dnf -y install 'dnf-command(copr)'
sudo dnf -y copr enable rhcontainerbot/container-selinux
sudo curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_8/devel:kubic:libcontainers:stable.repo
sudo dnf -y install podman
RHEL8.x/CENTOS8.x
podman version 1.8+
# CentOS 8 - Install Latest Podman
sudo dnf -y module disable container-tools
sudo dnf -y install 'dnf-command(copr)'
sudo dnf -y copr enable rhcontainerbot/container-selinux
sudo curl -L -o /etc/yum.repos.d/devel:kubic:libcontainers:stable.repo https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/stable/CentOS_8/devel:kubic:libcontainers:stable.repo
sudo dnf -y install podman
####
apiVersion: config.openshift.io/v1
kind: OAuth
metadata:
name: cluster
spec:
identityProviders:
- name: ldapidp
mappingMethod: claim
type: LDAP
ldap:
@ralvares
ralvares / regenerate-kubeconfig.sh
Created January 20, 2021 13:21 — forked from rcarrata/regenerate-kubeconfig.sh
Script for regenerating the kubeconfig for system:admin user
#!/bin/bash
AUTH_NAME="auth2kube"
NEW_KUBECONFIG="newkubeconfig"
echo "create a certificate request for system:admin user"
openssl req -new -newkey rsa:4096 -nodes -keyout $AUTH_NAME.key -out $AUTH_NAME.csr -subj "/CN=system:admin/O=system:masters"
echo "create signing request resource definition"
Fist, Create a MachineConfigPool
----
apiVersion: machineconfiguration.openshift.io/v1
kind: MachineConfigPool
metadata:
name: infra
spec:
machineConfigSelector:
matchExpressions:
oc edit Network.config.openshift.io cluster
---
# Please edit the object below. Lines beginning with a '#' will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: config.openshift.io/v1
kind: Network
metadata:
@ralvares
ralvares / dnsmasq.txt
Created February 25, 2021 10:45
DNSMASQ example
yum install dnsmasq -y
systemctl enable dnsmasq
cat > /etc/dnsmasq.d/ocp.conf << EOF
listen-address=127.0.0.1
bind-interfaces
addn-hosts=/etc/hosts.dnsmasq
address=/apps.ocp.ocp4.local/192.168.150.10
enable-tftp
tftp-root=/tftpboot
wget https://cloud.centos.org/centos/8/x86_64/images/CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2
qemu-img create -f qcow2 -b /var/lib/libvirt/images/CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2 /var/lib/libvirt/images/provisioner.qcow2 120G
virt-resize --expand /dev/vda1 /var/lib/libvirt/images/CentOS-8-GenericCloud-8.2.2004-20200611.2.x86_64.qcow2 /var/lib/libvirt/images/provisioner.qcow2
virt-customize -a /var/lib/libvirt/images/provisioner.qcow2 --root-password password:Redhat01 --uninstall cloud-init \
--hostname provisioner.ocp.ralvares.com \
--run-command 'yum update -y'
@ralvares
ralvares / community-catalog
Created March 16, 2021 07:58
Creating Community Custom Catalog for a Disconnected Cluster
# Community operators CatalogSource
## Download and Install opm tool
wget https://mirror.openshift.com/pub/openshift-v4/x86_64/clients/ocp/latest-4.7/opm-linux.tar.gz
tar xzvf opm-linux.tar.gz
mv opm /usr/local/bin
## Login to redhat registry
podman login registry.redhat.io