Skip to content

Instantly share code, notes, and snippets.

View jakoberpf's full-sized avatar

Jakob Boghdady jakoberpf

View GitHub Profile

[manual] create ceph filesystem

Configure MDS (MetaData Server) on a Node which you'd like to set MDS. It sets to [node01] on this exmaple.

ceph-deploy mds create node01

Create at least 2 RADOS pools on MDS Node and activate MetaData Server. For pg_num which is specified at the end of a creating command, refer to official document and decide appropriate value. Documentation

iptables cheatsheet

Show iptables rules

This will show the now current state of iptables

iptables -S

This will show all current iptable rules

redirect traffic incoming on a specific port to a different IP address / another server

2.2.2.2:4000 -> 1.1.1.1:3000

Solution

iptables -t nat -A PREROUTING -p tcp --dport 4000 -j DNAT --to-destination 1.1.1.1:3000
iptables -t nat -A POSTROUTING -p tcp -d 2.2.2.2 --dport 4000 -j SNAT --to-source 1.1.1.1
iptables -t nat -A POSTROUTING -j MASQUERADE
@jakoberpf
jakoberpf / rsync.md
Last active December 16, 2021 09:54

rsync commands

Basics

rsync -avzh <source> <username>@<ip>:<destination>

Advanced

exclude files/dirs based on patterns

@jakoberpf
jakoberpf / finalize namespace stuck in terminating state
Last active May 16, 2022 12:47
This script will terminate a given namespace, even if its stuck in the terminating state. Note that this will not trigger any ressource cleanup.
echo ATTENTION: THIS IS UNSAFE!
echo Which namespace would you like me to terminate\?
read NAMESPACE_TO_DESTROY
echo I will terminate namespace $NAMESPACE_TO_DESTROY\!
(
kubectl proxy &
kubectl get namespace $NAMESPACE_TO_DESTROY -o json |jq '.spec = {"finalizers":[]}' >temp.json
@jakoberpf
jakoberpf / Watch for warning events in all namespaces.sh
Created September 21, 2021 15:35
Watches for events with the type warning in all namespaces of a kubernetes cluster
watch -n -5 kubectl get events --all-namespaces=true --field-selector type=Warning