Skip to content

Instantly share code, notes, and snippets.

View isweluiz's full-sized avatar

Luiz isweluiz

View GitHub Profile

The video titled Introduction to Helm | Kubernetes Tutorial | Beginners Guide provides a comprehensive introduction to Helm, a package manager for Kubernetes. Below a summary of the key points:

  1. What is Helm?: Helm is a package manager for Kubernetes. It allows you to bring all of your YAML files together in what's called a chart. A chart can have a name, a description, and a version. A chart groups all these YAML files together in a templates folder.

  2. Why use Helm?: Helm is used to manage Kubernetes YAML files, which describe everything in Kubernetes, such as deployments, pods, services, config maps, secrets, and more. Helm makes these YAML files reusable, allowing you to inject parameters into them and reuse them among many applications and microservices.

  3. Creating a Helm Chart: A Helm chart is a unit of deployment made up of a set of YAML files. It can be for a microservice or any software like Redis, MySQL, Promet

@isweluiz
isweluiz / awk_netstat.sh
Created April 27, 2023 17:57 — forked from staaldraad/awk_netstat.sh
AWK to get details from /proc/net/tcp and /proc/net/udp when netstat and lsof are not available
# Gawk version
# Remote
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($3,index($3,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($3,i,2))}{print x":"strtonum("0x"substr($3,index($3,":")+1,4))}'
# Local
grep -v "rem_address" /proc/net/tcp | awk '{x=strtonum("0x"substr($2,index($2,":")-2,2)); for (i=5; i>0; i-=2) x = x"."strtonum("0x"substr($2,i,2))}{print x":"strtonum("0x"substr($2,index($2,":")+1,4))}'
# No Gawk
# Local
grep -v "rem_address" /proc/net/tcp | awk 'function hextodec(str,ret,n,i,k,c){
apt-get install python3-pip -y
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
sudo update-alternatives --config python
sudo update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 1
sudo update-alternatives --config pip
pip install aws-cdk.cdk
@isweluiz
isweluiz / .gitignore
Last active February 27, 2023 22:29
Terraform .gitignore
# Local .terraform directories
**/.terraform/*
# Crash log files
crash.log
# Local tfstate files
*.tfstate
*.tfstate.*

Sometimes we need to read a list of files, a list of lines, a list of directories or other list, which we need to use some parameter to read those list. With Ansible we have a lot of different kind of options to do that, sometimes looks complex, due to the reason to have many ways to do the same thing, but lets uncomplicate that.

How I said Ansible support many mechanism to interact over loops, the most common is with_items, the documentation with all the avalable option is here.

Let's see some good way and option, to review and remember later.

loops-options

Ansible

In an ideal world, all of your configuration information would be stored as Ansible variables, in the various places that Ansible lets you define variables (e.g., the vars section of your playbooks, files loaded by vars_files , files in the host_vars or group_vars directory).

Alas, the world is a messy place, and sometimes a piece of configuration data we need lives somewhere else. Maybe it’s in a text file or a .csv file, and we don’t want to just copy the data into an Ansible variable file because now you have to maintain two copies of the same data, and you believe in the DRY 2 principle. Or maybe the data isn’t maintained as a file at all; it’s maintained in a key-value storage service such as etcd.

Ansible has a feature called lookups that allows you to read i

First, if you need :) here you are the official documentation

Create a repo.

Make sure there is at least one file in it (even just the README.md)

Generate a SSH key pair (private/public):

ssh-keygen -t rsa -C "[email protected]"

If you are facing the following issue while using pip install application_name:

Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url

The following solution will help solve the problem:

Update the /etc/pip.conf with the following config:

@isweluiz
isweluiz / k8s-rancher-v1.2.4.md
Last active September 16, 2022 12:06
un Rancher agent in k8s v1.24 - no secret exists for service account cattle-system/cattle

Run Rancher agent in k8s v1.24 - no secret exists for service account cattle-system/cattle

I noticed some errors related to secret for service user acctount to import the Kubernetes cluster version v1.24 for rancher server v2.6, below I show the reason for that, and explain the reason based on the documentation. This error starts to happen after the K8s version 1.24 when some new features were enabled in Kubernetes version 1.24, including how the tokens are generated. Looks like many people departed with the same issue, see here. k8s

*The LegacyServiceAccountTokenNoAutoGeneration feature gate is beta, and enabled by default. When enabled, Secret API objects containing service account tokens are no longer auto-generated for every ServiceAccount. Use the [TokenRequest API](https://kubernetes.io/docs/reference/kubernetes-api/authentication-res