Skip to content

Instantly share code, notes, and snippets.

@mohanpedala
mohanpedala / bash_strict_mode.md
Last active April 23, 2024 11:47
set -e, -u, -o, -x pipefail explanation
@mohanpedala
mohanpedala / ssh_agent_forwarding_ansible.md
Created February 2, 2019 19:00
Ansible with SSH Agent Forwarding Tag: Bastion host
  • Create a “config” file that will be used by SSH-agent to do the forwarding of SSH connection.
$ cd .ssh
$ touch config
$ chmod 600 config
$ sudo vi config
SSH-agent forwarding
Host 
@mohanpedala
mohanpedala / nginx_performance_tuning.md
Last active March 25, 2024 06:03
NGINX Performance tuning

NGINX Performance Tuning

Content Compressions and Decompression

  • Documentation
    • NGINX http_gzip module
    • NGINX http_gunzip module
  • Enable gzip. by default, we’re not going to compress the responses that we’re getting from proxied servers or any piece of content that isn’t HTML.
  • But if one of our proxied servers happens to send us a pre-compressed response then we probably want to decompress it for clients that can’t handle gzip. In this situation, we’ll use the gunzip module
    $ vim /etc/nginx/nginx.conf
@mohanpedala
mohanpedala / generate_ssl_certs_automatically.md
Last active December 27, 2023 00:48
Generate SSL Certificates and renewing automatically using Let's Encrypt

Generating SSL Certificates using Let's Encrypt

  • Setup a real domain with an SSL certificate from Let’s Encrypt.
  • Prereq: Own a Domain
  • Documentaion
  • Seting a domain for binarybutter.com. DNS records are as follows
    NAME    TYPE    DATA
    @       A       MY_PUBLIC_IP_ADDRESS
    
@mohanpedala
mohanpedala / helm-cheatsheet.md
Created August 13, 2019 22:50 — forked from tuannvm/cka.md
#Helm #Kubernetes #cheatsheet, happy helming!
@mohanpedala
mohanpedala / k8s_network_troubleshooting.md
Last active December 8, 2023 17:37
k8s Network Trobleshooting

Network Troubleshooting

Inspecting Conntrack Connection Tracking

  • Prior to version 1.11, Kubernetes used iptables NAT and the conntrack kernel module to track connections. To list all the connections currently being tracked, use the conntrack command:
  • To list conntrack-tracked connections to a particular destination address, use the -d flag:
    conntrack -L -d 10.32.0.1
    

Node connection table full (issues making reliable connections to services)

  • It's possible your connection tracking table is full and new connections are being dropped. If that's the case you may see messages like the following in your system logs:
@mohanpedala
mohanpedala / 1-way-ssl.jpg
Last active November 23, 2023 17:44
One-Way SSL and Two-Way SSL
1-way-ssl.jpg
@mohanpedala
mohanpedala / different-container-design-patterns.md
Last active August 30, 2023 20:40
Different Container Design Patterns

Container Design Patterns

1. The single-container design pattern

Employing the single-container pattern means just putting your application into a container. It's how you usually start your container journey. But it's important to keep in mind that this pattern is all about simplicity, meaning that the container must have only one responsibility. That means it's an anti-pattern to have a web server and a log processor in the same container.

Containers are commonly used for web apps, where you expose an HTTP endpoint. But they can be used for many different things.

In Docker, you have the ability to change the behavior of a container at runtime, thanks to the CMD and ENTRYPOINT instructions. So I'm not limited to using containers for HTTP services. I can also use them for any bash script that accepts some parameters at runtime.

By letting containers change behavior at runtime, you can create a base container that can be reused in different contexts. So you'd use the single-container pattern to expose