Skip to content

Instantly share code, notes, and snippets.

@mohanpedala
mohanpedala / different-container-design-patterns.md
Last active Jan 19, 2022
Different Container Design Patterns
View different-container-design-patterns.md

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

@mohanpedala
mohanpedala / helm-install.md
Last active Sep 6, 2021
helm 2 and helm 3 installation on a linux machine
View helm-install.md

Helm 3 installation

  • Download the package and untar it.
wget https://get.helm.sh/helm-v3.0.2-linux-amd64.tar.gz

tar xvf helm-v3.0.2-linux-amd64.tar.gz
  • Move the package to the below location
mv linux-amd64/helm /usr/local/bin/helm3
@mohanpedala
mohanpedala / ReleaseViaJGitFlow.md
Created Sep 7, 2019 — forked from lemiorhan/ReleaseViaJGitFlow.md
How to make a release with Git and Maven via JGitFlow
View ReleaseViaJGitFlow.md

How to make a release with Git and Maven via JGitFlow

Imagine that you are versioning your sourcecode in git and building your code via maven. You need to make releases before deploying to production regularly. What should be the strategy we need to follow for releasing?

I've used maven-release-plugin for years to make releases. It worked perfectly with maven and svn, but we started to face problems when we migrated our code to git and to make releases on git.

After checking the literature, we decided to use JGit-Flow which is a maven plugin based on and is a replacement for the maven-release-plugin enabling support for git-flow style releases via maven.

I do not want to explain the details much because there are many great posts explaining all.

@mohanpedala
mohanpedala / Chart.yaml
Created Aug 14, 2019 — forked from jeroenr/Chart.yaml
Env specific helm deployment
View Chart.yaml
name: my-app-chart
version: 0.0.1 # Use Jenkinsfile for versioning
description: My App
keywords:
- app
maintainers:
- name: Jeroen Rosenberg
email: jeroen.rosenberg@gmail.com
engine: gotpl
@mohanpedala
mohanpedala / k8s_network_troubleshooting.md
Last active Jun 25, 2019
k8s Network Trobleshooting
View k8s_network_troubleshooting.md

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 / k8s_sa.md
Last active Apr 24, 2019
k8s service accounts
View k8s_sa.md
  1. Create service account for user Alice
kubectl create sa alice
  1. Get related secret
secret=$(kubectl get sa alice -o json | jq -r .secrets[].name)
  1. Get ca.crt from secret (using OSX base64 with -D flag for decode)
@mohanpedala
mohanpedala / k8s_metrics_horizontal_pod_scaling.md
Last active Jun 25, 2019
k8s Metrics and Horizontal Pod Scaling
View k8s_metrics_horizontal_pod_scaling.md

Create a Kubernetes Metrics Server

  1. To clone the GitHub repository of metrics-server, run the following command:
git clone https://github.com/kubernetes-incubator/metrics-server.git
cd metrics-server/
  1. To install Metrics Server from the root of the Metrics Server directory, run the following command:
kubectl create -f deploy/1.8+/