# cat check-network.sh

#!/bin/bash
# replace wlan0 with your device name
# as given by ip addr or ifconfig
while true 
do
    # keep checking if we have ip address and can ping outside  
    wifi_info=$(ip -4 -o addr  show wlan0 )
    ping -w 30 baidu.com
    #ping -w 10 google.com  # test bad case
    ping_result=$(echo $?)
    echo $ping_result
    
    while [ -n "$wifi_info" ] && [ $ping_result -eq 0 ];
    do
       sleep 180    # 180 sec = 3 minutes
       wifi_info=$(ip -4 -o addr  show wlan0 )
       ping -w 30 baidu.com
       #ping -w 10 google.com  # test bad case
       ping_result=$(echo $?)
       echo $ping_result
    done

    # We get here only if IP address is lost
    # which means we're off-line
    # restart wifi 
    nmcli radio wifi off
    sleep 10
    nmcli radio wifi on
    sleep 20  # wait that wifi restarts and connects
done

 

# crontab -l

...
# Run at the boot
@reboot /root/scripts/check-network.sh > /dev/null &

https://www.howtoforge.com/tutorial/passwordless-encryption-of-linux-root-partition/

http://www.ostechnix.com/reptyr-move-running-process-new-terminal/

Reverse ssh tunnel can be used on any ports:

http://otacon22.com/2010/02/01/ssh-reverse-tunneling-il-comando-supremo/

Use this script:

https://gist.github.com/ruario/9672798

I have the following machines:

  • 192.168.33.1: CentOS with private Docker registry
  • 192.168.33.10: CentOS Kubernetes master
  • 192.168.33.11: CentOS Kubernetes minion1
  • 192.168.33.12: CentOS Kubernetes minion2
  • 192.168.33.13: CentOS Kubernetes minion3

I want to push Docker images to the private registry and then use them in the Kubernetes cluster.

I must say docker to use the insecure registry. On all the Kubernetes nodes, edit the file /etc/sysconfig/docker, by adding the line:

INSECURE_REGISTRY='--insecure-registry 192.168.33.1:5000'

From my development machine (192.168.33.100) I push myimage to the private registry:

$ docker tag myimage 192.168.33.1:5000/myimage
$ docker push 192.168.33.1:5000/myimage

Then on the master I define the pod or replication controller, in a similar way:

# cat myimage-rc.yaml 
apiVersion: v1
kind: ReplicationController
metadata:
  name: my-image
spec:
  replicas: 2
  template:
    metadata:
      labels:
        app: myimage
    spec:
      containers:
      - name: myimage
        image: 192.168.33.1:5000/myimage
        ports:
        - containerPort: 80

Then I can create the pods from the master:

# kubectl create -f myimage-rc.yaml

Kubernetes will pull myimage from the private registry and create the pods.