Skip to content

Instantly share code, notes, and snippets.

Avatar
🥋

Roberto Carratala rcarrata

🥋
View GitHub Profile
@rcarrata
rcarrata / hibernate.md
Last active Jul 22, 2022
Hibernate Clusters with OpenShift Cluster Manager (OCM)
View hibernate.md
@rcarrata
rcarrata / check_certs.sh
Created Jun 14, 2022
Check Certificates from OpenShift 4
View check_certs.sh
#!/bin/bash
API=$(oc whoami --show-server | cut -d '/' -f3-)
APPS=$(oc whoami --show-console | cut -d '.' -f2-)
APPS_ROUTE="*.$APPS:443"
echo "## Certificate for $APPS_ROUTE"
echo | openssl s_client -connect $APPS_ROUTE | openssl x509 -noout -text
echo "--------------------------------"
echo ""
@rcarrata
rcarrata / enable_osd_gcp_apis.sh
Last active Apr 27, 2022
Enable APIs in GCP for OpenShift Dedicated installation
View enable_osd_gcp_apis.sh
# Enable APIs OSD in GCP
# based in https://docs.openshift.com/dedicated/osd_planning/gcp-ccs.html#ccs-gcp-customer-procedure_gcp-ccs
# Set your GCP project
PROJECT_ID="mygcp-project"
echo "# Setting your $PROJECT_ID GCP project"
gcloud config set project $PROJECT_ID
# Enable required APIs in GCP
apis=("deploymentmanager.googleapis.com" "compute.googleapis.com" "cloudapis.googleapis.com" \
@rcarrata
rcarrata / upgrade-4.9.sh
Created Nov 8, 2021
Upgrade OCP to 4.9
View upgrade-4.9.sh
#!/bin/bash
# Set up a the patch for upgrade towards 4.9 safely
# Check https://access.redhat.com/articles/6329921 for more information
oc -n openshift-config patch cm admin-acks --patch '{"data":{"ack-4.8-kube-1.22-api-removals-in-4.9":"true"}}' --type=merge
# Change the channel to the Fast 4.9 (Stable 4.9 not available at this moment
oc patch clusterversion version --type="merge" -p '{"spec":{"channel":"fast-4.9"}}'
# Upgrade towards the latest
@rcarrata
rcarrata / pods-example.sh
Last active Oct 14, 2021
Networking Example - hostNetwork | hostPID | hostIPC | hostPort | NodePort | Capabilities examples
View pods-example.sh
#### Prereqs
kubectl create ns influx
oc adm policy add-scc-to-user anyuid -z default -n influx
#### HostNetwork
# pods in the host network of a node can communicate with all pods on all nodes without NAT
# Not using a separated network namespace. The pod will see the entire ip stack
# https://kubernetes.io/docs/concepts/cluster-administration/networking/#the-kubernetes-network-model
cat <<EOF > /tmp/influxdb-hostnetwork.yaml
@rcarrata
rcarrata / aws-creds.sh
Last active Oct 4, 2021
Install AWS and set up AWS Credentials
View aws-creds.sh
echo "## Please give me the AWSKEY"
read AWSKEY
echo "## Please give me the AWS_SECRET_KEY"
read AWSSECRETKEY
echo "## Please give me the REGION"
read REGION
aws --version &> /dev/null
@rcarrata
rcarrata / idracadm7.sh
Last active Sep 27, 2021
Mount iDrac Virtual Media Script
View idracadm7.sh
cat /etc/yum.repos.d/racadm.repo <<EOF
[racadm]
name=Racadm
baseurl=http://linux.dell.com/repo/hardware/dsu/os_dependent/RHEL8_64
enabled=1
gpgcheck=0
EOF
yum clean all
View kind_centos8
# Install utils
sudo yum -y install wget yum-utils bash-completion vim
# Install Docker
sudo yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
sudo yum remove -y podman
sudo yum install docker-ce docker-ce-cli containerd.io -y
sudo systemctl start docker
View gist:a93598e8ddda971c532ee118255f08f8
#!/bin/bash
# Install Golang
wget https://dl.google.com/go/go1.15.2.linux-amd64.tar.gz
tar -xvf go1.15.2.linux-amd64.tar.gz
mv go /usr/local
export GOROOT=/usr/local/go
export GOPATH=$HOME
export PATH=$GOPATH/bin:$GOROOT/bin:$PATH
go version
@rcarrata
rcarrata / regenerate-kubeconfig.sh
Last active Nov 18, 2022
Script for regenerating the kubeconfig for system:admin user
View regenerate-kubeconfig.sh
#!/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"
echo "create signing request resource definition"