Skip to content

Instantly share code, notes, and snippets.

View jovemfelix's full-sized avatar

RENATO ALVES FELIX jovemfelix

View GitHub Profile
@jovemfelix
jovemfelix / redhat_support-tools--Curl-Pod.md
Last active September 21, 2022 12:24
Usefull for debugging

Running Pod with utilities

cat <<EOF | oc apply -f -
---
apiVersion: v1
kind: Pod
metadata:
  name: curl-pod
  labels:
 app: support
@jovemfelix
jovemfelix / Playing-With-JsonPath-Template.md
Last active August 31, 2022 12:44
Examples using jsonpath with Kubernetes or Openshift

Get JSON

$ oc get backup -o json

JSON to be parsed

{
    "apiVersion": "v1",
    "items": [
## Reference: https://github.com/jovemfelix/sno-minio-deployment
---
#NAME: minio
#LAST DEPLOYED: Thu Aug 25 08:55:33 2022
#NAMESPACE: minio
#STATUS: pending-install
#REVISION: 1
#TEST SUITE: None
#HOOKS:
#MANIFEST:

Steps

$ oc project openshift-ingress
$ statsPassword=$(oc extract secret/router-stats-default --keys=statsPassword --to=-)
$ statsUsername=$(oc extract secret/router-stats-default --keys=statsUsername --to=-)

$ oc get pods
$ oc exec -it pod/router-default-577b87cd94-jv5s7 -- curl -s -u ${statsUsername}:${statsPassword} 127.0.0.1:1936/metrics | grep haproxy

Reference

apiVersion: integreatly.org/v1alpha1
kind: GrafanaDashboard
metadata:
name: dashboard-ingress
labels:
app: 3scale-monitoring. # adequar para o cenário
spec:
json:
""
configMapRef:
ORIGINAL_FILE=$1
echo cleaning $1
yq eval 'del(.metadata.annotations."kubectl.kubernetes.io/last-applied-configuration")' -i $ORIGINAL_FILE
yq eval 'del(.metadata.creationTimestamp)' -i $ORIGINAL_FILE
yq eval 'del(.metadata.generation)' -i $ORIGINAL_FILE
yq eval 'del(.metadata.managedFields)' -i $ORIGINAL_FILE
yq eval 'del(.metadata.ownerReferences)' -i $ORIGINAL_FILE
yq eval 'del(.metadata.resourceVersion)' -i $ORIGINAL_FILE
# version used
$ yq -V
yq version 4.9.6
$ cp original-file.yaml original-file.orig.yaml
# this for single file
$ yq eval '.metadata.annotations."kubectl.kubernetes.io/last-applied-configuration"' -i original-file.yaml
$ yq eval 'del(.metadata.creationTimestamp)' -i original-file.yaml
$ yq eval 'del(.metadata.generation)' -i original-file.yaml

Variables

export NS=benchmark-operator
export ES_SERVER=${ES_SERVER:-https://search-perfscale-dev-chmf5l4sh66lvxbnadi4bznl3a.us-west-2.es.amazonaws.com:443}

Grafana

Requirements

@jovemfelix
jovemfelix / Copy-sosrerport-from-Node-using-oc-debug.md
Created July 5, 2022 12:56
How to Copy sosrerport from Node using oc debug? Not ssh!

How to Copy Files from NODE using oc cp?

At Openshift 4.x that recomends using oc debug instead of ssh bellow I'll explain how to do it.

At Terminal 01

Start Node DEBUGING

$ oc debug node/k8sdemo-hxvrp-master-2
# remember to change chroot /host

Apache Setup

Create Project

$ oc new-project test-same-hostname-01

View existing Images