Skip to content

Instantly share code, notes, and snippets.

View zulhfreelancer's full-sized avatar

Zulhilmi Zainudin zulhfreelancer

View GitHub Profile
@zulhfreelancer
zulhfreelancer / nginx-controller-certificate-signed-by-unknown-authority-error.md
Created June 27, 2023 04:42
How to fix Nginx ingress controller "certificate signed by unknown authority" error?

Problem

How to fix Nginx ingress controller "certificate signed by unknown authority" error?

Error:

"Internal error occurred: failed calling webhook \"validate.nginx.ingress.kubernetes.io\": failed to call webhook: Post \"https://nginx-ingress-ingress-nginx-controller-admission.default.svc:443/networking/v1/ingresses?timeout=10s\": x509: certificate signed by unknown authority"
@zulhfreelancer
zulhfreelancer / measure-response-time-curl.md
Last active December 15, 2023 19:29
How to measure response time using `curl`?

How to measure response time using curl?

Command:

curl -kv -w '\n* Response time: %{time_total}s\n' <IP_OR_URL>

Example:

@zulhfreelancer
zulhfreelancer / find-kubernetes-role-or-clusterrole-for-serviceaccount.md
Created June 19, 2023 03:41
How to find Kubernetes Role or ClusterRole linked to a specific ServiceAccount?

How to find Kubernetes Role or ClusterRole linked to a specific ServiceAccount?

kubectl get rolebinding,clusterrolebinding --all-namespaces -o jsonpath='{range .items[?(@.subjects[0].name=="SERVICE_ACCOUNT_NAME")]}[{.roleRef.kind},{.roleRef.name}]{end}'
@zulhfreelancer
zulhfreelancer / show-all-docker-build-logs.md
Created June 1, 2023 08:25
How to show all `docker build` logs?

How to show all docker build logs?

docker build -t YOUR-USER-NAME/YOUR-REPO:<YOUR-IMAGE-TAG> --no-cache --progress=plain .
@zulhfreelancer
zulhfreelancer / dynamic-favicon-fetcher.md
Created March 18, 2023 13:12
How to dynamically fetch website favicon image?

Format

https://www.google.com/s2/favicons?domain=example.com

Example

https://www.google.com/s2/favicons?domain=github.com
@zulhfreelancer
zulhfreelancer / view-yaml-gz-k8s-secret.md
Created January 12, 2023 03:02
How to view the content of *.yaml.gz file stored in Kubernetes secret?

How to view the content of *.yaml.gz file stored in Kubernetes secret?

$ kubectl -n <NAMESPACE> get secret <SECRET> -o json | jq -r '.data."prometheus.yaml.gz"' | base64 -d | gunzip
@zulhfreelancer
zulhfreelancer / how-to-check-free-ram-linux.md
Created November 23, 2022 03:14
How to check free RAM/memory on Linux system?
@zulhfreelancer
zulhfreelancer / delete-heroku-apps.sh
Last active April 13, 2023 06:04
How to bulk delete or leave all Heroku apps using bash script, Heroku CLI and jq?
# List all apps
heroku apps
# Delete all apps created by yourself
for app in $(heroku apps --json | jq -r '.[] | select(.owner.email == "<insert-heroku-email-here>") | .name'); do echo $app | heroku apps:destroy $app; done
# Leave all apps created by others where you were a collaborator
for app in $(heroku apps --json | jq -r '.[] | select(.owner.email != "<insert-heroku-email-here>") | .name'); do heroku apps:leave -a $app; done
# List all apps again
@zulhfreelancer
zulhfreelancer / dummy-exporter-deployment.yaml
Created October 31, 2022 08:11
Dummy / fake Prometheus exporter for Kubernetes testing
apiVersion: v1
kind: Namespace
metadata:
name: dummy-exporter
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: dummy-exporter