Skip to content

Instantly share code, notes, and snippets.

View d3athkai's full-sized avatar
🦾
Kaizen

SK d3athkai

🦾
Kaizen
  • Singapore
  • 23:37 (UTC +08:00)
View GitHub Profile

Kubernetes Tips and Tricks

A collection of some of my useful Kubernetes Tips and Tricks.


Unable to delete Custom Resource Definition (CRD)

If the normal way of deleting a CRD does not work, ie:
kubectl delete crd/<CRD_NAME>

Try the following instead:

Auto-Completion for Kubectl in Kubernetes

Introduction

Auto-Completion for Kubectl allows you to set up an alias for kubectl on bash cli.
Auto-completion can be very useful to avoid having to reference a cheat sheet constantly when using kubectl commands to interact with your Kubernetes cluster.
Benefits:

  • Efficiency – reduce the amount of typing required, especially in very long commands
  • Minimize errors – by suggesting command completions, you minimize the chances for mistyping, thus reducing overall frustration
  • Enhanced learning – this is beneficial, especially for people just starting out with K8s, as auto-completion can serve as an education tool by showing available commands and options users may not be familiar with
  • Increased productivity – streamline workflows by allowing users to execute commands more quickly and accurately
@d3athkai
d3athkai / Screen.md
Created April 26, 2023 16:46
Screen Usage

Screen

Screen or GNU Screen is a terminal multiplexer. In other words, it means that you can start a screen session and then open any number of windows (virtual terminals) inside that session. Processes running in Screen will continue to run when their window is not visible even if you get disconnected.

Usage

Start a Named Session

screen -S <session_name>

List all Sessions

screen -list

@d3athkai
d3athkai / Linux Tips and Tricks.md
Last active January 13, 2024 04:37
Linux Tips and Tricks

Linux Tips and Tricks

A collection of some of my useful Linux Tips and Tricks.


Check if a restart is needed

If a restart is required in a Linux instance, it will add a file: /var/run/reboot-required.
It contains the message *** System restart required ***.


Check and Auto-Fix File System

Linux CLI to download releases from GitHub Repo

  • Use curl to get the JSON response for the latest release
  • Use grep to find the line containing file URL
  • Use cut and tr to extract the URL
  • Use wget to download it
curl -s https://api.github.com/repos/jgm/pandoc/releases/latest \
| grep "browser_download_url.*deb" \

Free DNS

https://nip.io is a dead simple wildcard DNS for any IP Address without any registration.
nip.io maps <anything>[.-]<IP Address>.nip.io to .
Can be useful for application deployments with apache/nginx.

Usage examples

To give URL for your ip 192.168.0.1, you can have the following URLs:

  • 192.168.0.1.nip.io
  • anything.192.168.0.1.nip.io
@d3athkai
d3athkai / RegEx Tips and Tricks.md
Last active January 5, 2024 02:37
Regular Expression Tips and Tricks

Regular Expression Tips and Tricks

A collection of some of my useful Regular Expression Tips and Tricks.


Detect all variants of text

Given the following list of input:

1test2
test2
1test
@d3athkai
d3athkai / Linux CSR.md
Last active April 27, 2024 11:01
Certificate Signing Request (CSR) in Linux

Generate Linux CSR

This guide will show you how to generate certificate signing request (CSR) file in Linux system.
The CSR file generated will be sent and signed by the CA server.

Subject Alternative Name (SAN) is required by chromium-based browers such as Chrome or Microsoft Edge.
Without SAN, chromium-based browers will still display the SSL error: ERR_CERT_COMMON_NAME_INVALID.

Generate client private key:
openssl genrsa -out myhost.example.com.key 2048