Skip to content

Instantly share code, notes, and snippets.

View adrianriobo's full-sized avatar
🎯
Focusing

Adrián Riobo Lorenzo adrianriobo

🎯
Focusing
View GitHub Profile
@adrianriobo
adrianriobo / istio-requests-troubleshooting.sh
Created January 25, 2019 12:23
Troubleshooting istio requests
#Access istio proxy for concrete pod
kubectl -n $namespace $pod -c istio-proxy -- /bin/bash
#Use TCP dump to troubleshooting the requests
sudo tcpdump -vvv -i eth0 -A 'tcp[((tcp[12:1] & 0xf0) >> 2):4] = 0x47455420'
@adrianriobo
adrianriobo / kafka_message_check.sh
Last active October 16, 2019 07:17
Kafka tools related commands
#List topics
kafka-topics --zookeeper zk01.example.com:2181 --list
#Get kafka offsets info from kafka internal topic with ssl configuration
#included formatter to translate binary data
kafka-console-consumer --bootstrap-server 10.180.48.138:19093 --topic __consumer_offsets \
--formatter "kafka.coordinator.group.GroupMetadataManager\$OffsetsMessageFormatter" \
--from-beginning --consumer-property bootstrap.servers=10.180.48.138:19093 \
--consumer-property security.protocol=SSL \
--consumer-property ssl.truststore.location=/etc/kafka/secrets/kafka.truststore.jks \
@adrianriobo
adrianriobo / Buildah with Dockerfile
Created April 22, 2020 14:02
Buildah with Dockerfile
# Run container with docker context
docker run -it --privileged -v $PWD:/opt quay.io/buildah/stable:v1.14.0 bash
# Build image
buildah bud --format oci --storage-driver=vfs --layers -t image:version .
# Get ECR credentials
aws ecr get-login
export ECR_LOGIN=AWS
export ECR_TOKEN=...
@adrianriobo
adrianriobo / kubectl-helper.sh
Last active May 20, 2020 07:05
Kubectl commands
#Go templating with special characters:
#Check ephemeral storage per node due to pod eviction
kubectl get nodes $NODE_ID \
-o go-template='{{ $ephemeral := index .status.allocatable "ephemeral-storage" }}{{ $ephemeral}}'
@adrianriobo
adrianriobo / certs_management.sh
Last active September 23, 2020 13:28
Some linux commands on troubleshooting
#Download certs from site
echo "" | openssl s_client -host {HOST} -port 443 -showcerts | awk '/BEGIN CERT/ {p=1} ; p==1; /END CERT/ {p=0}' > allcerts.pem
#Import certs
keytool -import -alias your-alias -keystore cacerts -file certificate.der
@adrianriobo
adrianriobo / bash-sample.sh
Last active December 18, 2020 06:31
Proper way to create bash scripts with set command included
#!/bin/bash
set -exuo pipefail
[explanation](https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425)
# kill all the child processes for this script when it exits
trap 'jobs=($(jobs -p)); ((${#jobs})) && kill "${jobs[@]}" || true; exit 0' TERM
@adrianriobo
adrianriobo / podman-systemd-generator.sh
Created October 15, 2020 14:55
podman as systemd generator
#!/bin/bash
podman run -d --name=gvisor-tap-vsock --privileged --net=host -it quay.io/crcont/gvisor-tap-vsock:v3
podman generate systemd --restart-policy=no gvisor-tap-vsock > /etc/systemd/system/gvisor-tap-vsock.service
systemctl daemon-reload
systemctl enable gvisor-tap-vsock.service
@adrianriobo
adrianriobo / Network.ps
Last active December 9, 2020 08:53
Powershell for DNS
# Check rules
Get-DnsClientNrptRule
#Set metric to manage interface precedence order
Set-NetIPInterface -InterfaceIndex 17 -InterfaceMetric 15
# Check / Set DNS address
Get-DnsClientServerAddress
Set-DnsClientServerAddress -InterfaceIndex 17 -ServerAddresses ("172.17.167.38")
Set-DnsClientServerAddress -InterfaceIndex 17 -ResetServerAddresses
@adrianriobo
adrianriobo / filesystem.sh
Created November 23, 2020 07:58
Linux troubleshooting
# Check largest files
sudo du -a /dir/ | sort -n -r | head -n 20
@adrianriobo
adrianriobo / gpg-mgmt.sh
Last active December 4, 2020 07:34
gpg management
# Generate gpg use same email as verified account on Git
gpg --full-generate-key
# Get keys info
gpg --list-secret-keys --keyid-format LONG
# Upload key to server and sign to verify
gpg --export your@email.com | curl -T - https://keys.openpgp.org
# Configure to work with keyserver