This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Problem Description: | |
How to resolve scheduler and controller-manager unhealthy state in Kubernetes | |
# Symptom: | |
$ kubectl get cs / kubectl get componentstatuses | |
Warning: v1 ComponentStatus is deprecated in v1.19+ | |
NAME STATUS MESSAGE ERROR | |
controller-manager Unhealthy Get "http://127.0.0.1:10252/healthz": dial tcp 127.0.0.1:10252: connect: connection refused | |
scheduler Unhealthy Get "http://127.0.0.1:10251/healthz": dial tcp 127.0.0.1:10251: connect: connection refused | |
etcd-0 Healthy {"health":"true"} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
( | |
NAMESPACE=your-rogue-namespace | |
kubectl proxy & | |
kubectl get namespace $NAMESPACE -o json |jq '.spec = {"finalizers":[]}' >temp.json | |
curl -k -H "Content-Type: application/json" -X PUT --data-binary @temp.json 127.0.0.1:8001/api/v1/namespaces/$NAMESPACE/finalize | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[client] | |
user=backup | |
password=ffgf43rger43gtregrt43hr23 | |
[mysqld] | |
socket=/var/run/mysqld/mysqld.sock | |
datadir=/var/lib/mysql | |
innodb_log_group_home_dir=/var/lib/mysql |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DRBD (Distributed Replicated Block Device) is a really cool cluster solution to have radundant data on two or more nodes. Everybody know RAID, DRBD is like RAID 1 over network. | |
Install DRBD virtual package (This will work on Debian and Ubuntu): | |
apt-get install drbd-utils | |
I my case DRBD is running under control of my cluster-software, that means DRBD will be managed by corosync. I remove DRBD from upstart: | |
insserv -v -r drbd remove | |
We need to start the driver and tell Linux to load it the next time when it boots: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### KERNEL TUNING ### | |
# Increase size of file handles and inode cache | |
fs.file-max = 2097152 | |
# Do less swapping | |
vm.swappiness = 10 | |
vm.dirty_ratio = 60 | |
vm.dirty_background_ratio = 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo apt update && sudo apt upgrade -y | |
sudo apt install strongswan -y | |
sudo vi /etc/sysctl.conf | |
net.ipv4.ip_forward = 1 | |
net.ipv4.conf.all.accept_redirects = 0 | |
net.ipv4.conf.all.send_redirects = 0 | |
sudo sysctl -p /etc/sysctl.conf | |
openssl rand -base64 64 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## | |
# nginx server with http + ssl/https (Front) | |
# /etc/nginx/sites-available/example.com | |
server { | |
listen 80; | |
server_name example.com; | |
location / { | |
proxy_pass http://no-ssl:8080; | |
proxy_set_header Host $host; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
while IFS='' read -r line || [[ -n "$line" ]]; do | |
echo '' | db2struct --host localhost -d farayad --package farayad -p --user root --struct=$line -t $line --gorm --guregu | |
done < "$1" | |
usage: | |
1-show tables; | |
2-store table name in tablename.txt file. | |
3- run: bash mysql2go.sh tablename.txt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[mysqld] | |
# Path to Galera library | |
wsrep_provider=/usr/lib/galera3/libgalera_smm.so | |
# Cluster connection URL contains IPs of nodes | |
#If no IP is found, this implies that a new cluster needs to be created, | |
#in order to do that you need to bootstrap this node | |
wsrep_cluster_address=gcomm://172.16.10.20,172.16.20.20,172.16.30.20 | |
# In order for Galera to work correctly binlog format should be ROW |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Template my.cnf for PXC | |
# Edit to your requirements. | |
[mysqld] | |
server-id=1 | |
datadir=/var/lib/mysql | |
socket=/var/run/mysqld/mysqld.sock | |
log-error=/var/log/mysqld.log | |
pid-file=/var/run/mysqld/mysqld.pid | |
log-bin | |
log_slave_updates |