Monday, September 28, 2020

Kubectl Cheatsheet

kubectl get svc --all-namespaces  | awk '{{gsub(/,/, ";", $6)}; a = ""; for (i = 1 ; i <= NF -1 ; i++) a = a $i "," ; print substr(a, 1, length(a)-1)}'

Wednesday, September 16, 2020

HAProxy Config Sample

 defaults

        timeout connect 5000ms

        timeout client 50000ms

        timeout server 50000ms


# This listener is for stats only no proxying

listen stats 192.168.88.10:80

    mode http

    stats enable

    stats hide-version

    stats realm Haproxy\ Statistics

    stats uri /

    stats auth admin:loyalty # Change this to your own username and password!




# Break Line

listen breakline 192.168.88.13:80

    mode tcp

    balance roundrobin

    # check every 5 seconds.  Take down/up after two failed attempts.

    server primary   10.156.68.6:80 weight 1 check port 80 inter 5s rise 2 fall 3

    server secondary 138.16.222.233:80 backup weight 1 check port 80 inter 5s rise 2 fall 3

Tuesday, September 8, 2020

Linux: PID file /var/run/sshd.pid not readable (yet?) after start.

 Problem: 

PID file /var/run/sshd.pid not readable (yet?) after start.

Red Hat Enterprise Linux Server release 7.0 (Maipo)

CentOS Linux release 7.3.1611 (Core) 



Reference:

https://bugzilla.redhat.com/show_bug.cgi?id=1415218

Thursday, September 3, 2020

Kubernetes: RabbitMQ

https://github.com/bitnami/charts

https://github.com/bitnami/charts/tree/master/bitnami/rabbitmq



https://github.com/rabbitmq/diy-kubernetes-examples.git

https://www.rabbitmq.com/blog/2020/08/10/deploying-rabbitmq-to-kubernetes-whats-involved/


$ helm repo add bitnami https://charts.bitnami.com/bitnami

$ helm search repo bitnami

$ helm install my-release bitnami/<chart>


$ helm install art-rmq --namespace rabbitmq-qa \

  --set auth.username=admin,auth.password=changeme,auth.erlangCookie=secretcookie \

    bitnami/rabbitmq


$ helm install art-rmq01 --namespace rabbitmq-qa \

  --set auth.username=admin,auth.password=changeme,auth.erlangCookie=secretcookie \

    bitnami/rabbitmq


$ helm install art-rmq02 --namespace rabbitmq-qa \

  --set auth.username=admin,auth.password=changeme,auth.erlangCookie=secretcookie,metrics.serviceMonitor.namespace=rabbitmq-qa,metrics.prometheusRule.namespace=rabbitmq-qa \

    bitnami/rabbitmq


To Access the RabbitMQ Management interface:


    echo "URL : http://127.0.0.1:15673/"

    kubectl port-forward --namespace default svc/art-rmq01-rabbitmq 15673:15672


rabbit@art-rmq-rabbitmq-0.art-rmq-rabbitmq-headless.default.svc.cluster.local




$ kubectl exec -it /art-rmq01-rabbitmq-0 bash


$ rabbitmqctl status

$ rabbitmqctl stop_app

rabbitmqctl join_cluster --ram rabbit@art-rmq-rabbitmq-0.art-rmq-rabbitmq-headless.default.svc.cluster.local

rabbitmqctl start_app

rabbitmqctl cluster_status


Wednesday, September 2, 2020

Openssl to verify SSL certificate

 $ echo | openssl s_client -showcerts -servername www.ibm.com -connect www.ibm.com:443 2>/dev/null | openssl x509 -inform pem -noout -text