Skip to content

Instantly share code, notes, and snippets.

@ikurni
ikurni / rhv-important-kb
Last active July 30, 2021 17:37
RHV Important KB
https://access.redhat.com/solutions/396753 --> Remove Locked Entities Manually
##How to Clean up Task in RHV :
#List Tasks :
/usr/share/ovirt-engine/setup/dbutils/taskcleaner.sh
#Kill Tasks :
/usr/share/ovirt-engine/setup/dbutils/taskcleaner.sh -t <taskID>
@ikurni
ikurni / force-bootstrap-machine-config
Created July 24, 2021 07:28
Force Re-run Openshift First Bootstrap
### If nodes is stuck in pulling images, or connection are too slow, sometime process can't move. Below is how to re-trigger ###
/run/bin/machine-config-daemon firstboot-complete-machineconfig
@ikurni
ikurni / openshift-important-kb
Last active August 25, 2023 00:28
Bookmarked Red Hat KB for Openshift
### Openshift Summarized KB ###
https://access.redhat.com/node/5218861
### PipelineRun takes a lot of time to get started on OpenShift Container Platform 4 ###
https://access.redhat.com/solutions/7005157
### Cluster Updates Without Error but Machine Config Pools Degraded with `Marking Degraded due to: unexpected on-disk state` on 4.6 and newer
https://access.redhat.com/solutions/5598401
### How to Use 'fio' to Check Etcd Disk Performance in OCP
@ikurni
ikurni / etcd-perf-check
Last active September 6, 2021 20:25
ETCD Performance Check
### Performance check command from etcd pod
# oc rsh <etcd-pod> -n openshift-etcd
$ etcdctl check perf --load="m"
$ etcdctl check perf --load='l'
$ etcdctl --write-out=table endpoint status
$ etcdctl --write-out=table endpoint health
$ etcdctl --write-out=table member list
### Collect metrics from the cluster.
@ikurni
ikurni / pods-imagepullbackoff-auth-required
Created May 4, 2021 06:48
Pods Error ImagePullBackOff - Authentication Required
### Most probably is caused by different pull secret that is being used by serviceaccount to pull the images ###
### Edit imagePullSecret which is used by serviceaccount ###
oc edit sa <serviceaccountname>
# Edit below section
apiVersion: v1
imagePullSecrets:
- name: jenkins-dockercfg-8nln8 #change to available pullsecrets which can be used to pull from image-registry#
# Save the config #
@ikurni
ikurni / pods-stuck-in-terminating
Created April 27, 2021 16:03
Delete pods stuck in terminating
### Step 1
oc delete pod <podsname> -n myproject --grace-period=0 --force
### Step 2
oc edit pod <podsname>
#Remove deletionTimestamp
#Before: deletionTimestamp: 2019-12-31T11:40:28Z
#After: deletionTimestamp: null
#Remove Finalizers
#Before
@ikurni
ikurni / haproxy-set-headers-redirect-https
Last active October 12, 2021 15:07
HAProxy Replace URL Headers and Redirect HTTPS to HTTP
### Create SSL file for HTTPS traffic
mkdir /etc/haproxy/ssl
cat /root/wildcard.example.com.crt /root/wildcard.example.com.key >> /root/wildcard.example.com.pem
mv /root/wildcard.example.com.pem /etc/haproxy/ssl/
### Configure HAProxy.cfg to accept HTTPS, redirect HTTPS to HTTP and replace header to targeted URL
vi /etc/haproxy/haproxy.cfg
#---
#---------------------------------------------------------------------
@ikurni
ikurni / enable-rook-ceph-tools
Created March 9, 2021 03:41
Enable Rook Ceph Tools in OCS 4+
### Run below command to enable rook-ceph-tools in OCS Cluster
oc patch OCSInitialization ocsinit -n openshift-storage --type json --patch '[{ "op": "replace", "path": "/spec/enableCephTools", "value": true }]'
@ikurni
ikurni / manually-remove-OCS-openshift
Last active March 9, 2021 03:05
How to Manually remove OCS Cluster from Openshift
### In order to remove OCS Cluster manually, when resources are stucked, need to patch the resources manually as below :
[root@ocpbastion ~]# oc patch -n openshift-stroage crd/cephobjectstoreusers.ceph.rook.io --type=merge -p '{"metadata": {"finalizers":null}}'
customresourcedefinition.apiextensions.k8s.io/cephobjectstoreusers.ceph.rook.io patched
[root@ocpbastion ~]# oc patch -n openshift-stroage crd/cephblockpools.ceph.rook.io --type=merge -p '{"metadata": {"finalizers":null}}'
customresourcedefinition.apiextensions.k8s.io/cephblockpools.ceph.rook.io patched
[root@ocpbastion ~]# oc patch -n openshift-stroage crd/cephclusters.ceph.rook.io --type=merge -p '{"metadata": {"finalizers":null}}'
customresourcedefinition.apiextensions.k8s.io/cephclusters.ceph.rook.io patched
[root@ocpbastion ~]# oc patch -n openshift-stroage crd/cephfilesystems.ceph.rook.io --type=merge -p '{"metadata": {"finalizers":null}}'
customresourcedefinition.apiextensions.k8s.io/cephfilesystems.ceph.rook.io patched
@ikurni
ikurni / verify-ssl-cert-key
Created January 29, 2021 07:12
Verify SSL Cert with Key Pair
# How do I verify that a private key matches a certificate?
# To verify that a private key matches its certificate you need to compare the modulus of the certificate against the modulus of the private key.
#Please follow the below command to view the modulus of the certificate.
openssl x509 -noout -modulus -in server.crt | openssl md5
#Now you will receive the modulus something like a77c7953ea5283056a0c9ad75b274b96
#Please follow the below command to view the modulus of the private key.