Skip to content

Instantly share code, notes, and snippets.

View avoidik's full-sized avatar
🎯
Focusing

Viacheslav Vasilyev avoidik

🎯
Focusing
View GitHub Profile
@avoidik
avoidik / README.md
Last active October 26, 2024 22:31
Generate user certificate for K8s authentication

Using Kubernetes approval workflow

Generate private key

openssl genrsa -out DevDan.key 2048

Generate csr

@avoidik
avoidik / README.md
Last active August 20, 2022 07:10
Kubernetes Demo Applications
@avoidik
avoidik / aws-auth-cm.sh
Created May 22, 2021 17:31 — forked from pmatv/aws-auth-cm.sh
Map IAM group to EKS ConfigMap
#!/usr/bin/env bash
set -o errexit
set -o nounset
set -o pipefail
IAM_GROUP=${1:-admins}
EKS_ROLE_ARN=${2:-arn:aws:iam::111122223333:role/eks-node-role}
RBAC_GROUP=${3:-system:masters}
@avoidik
avoidik / curl.sh
Last active August 10, 2024 17:12
Use curl instead of kubectl
#!/bin/bash
#
# download yq
#
curl -fsSL https://github.com/mikefarah/yq/releases/download/v4.43.1/yq_linux_amd64 -o /usr/local/bin/yq
chmod +x /usr/local/bin/yq
#
@avoidik
avoidik / install-containerd.sh
Created May 16, 2021 13:29
How to use containerd with conf_template option
DASEL_VER="1.15.0"
CRI_VER="1.5.1"
#
# install dasel
#
curl -fsSL "https://github.com/TomWright/dasel/releases/download/v${DASEL_VER}/dasel_linux_amd64" -o /usr/local/bin/dasel
chmod +x /usr/local/bin/dasel
@avoidik
avoidik / 01_schedule_automl_job.py
Last active May 15, 2021 11:59
AWS SageMaker hands-on - Taken from Data science on AWS book
import boto3
import sagemaker
from time import gmtime, strftime, sleep
#
# be careful, this might be very expensive operation!
#
session = sagemaker.Session(default_bucket='my-demo-amazon-reviews-bucket')
bucket = session.default_bucket()
@avoidik
avoidik / tsv2csv.sh
Last active May 15, 2021 12:06
Convert amazon-reviews-pds from TSV to CSV
pip install -U awscli pandas
aws s3 cp s3://amazon-reviews-pds/tsv/amazon_reviews_us_Automotive_v1_00.tsv.gz .
cat << 'EOF' | python
import pandas as pd
fields = ['star_rating', 'review_body', 'review_id']
dfs = pd.read_csv('amazon_reviews_us_Automotive_v1_00.tsv.gz', sep='\t', usecols=fields, compression='gzip', chunksize=100)
for df in dfs:
df.to_csv('amazon_reviews_us_Automotive_v1_00.csv', index=None, header=True, mode='a')
@avoidik
avoidik / cloud-init.yaml
Last active March 3, 2023 15:41
Run EC2 using AWS CLI with user-data
#cloud-config
package_update: false
package_upgrade: false
ssh_authorized_keys:
- 'ssh-rsa AAAA...'
- 'ssh-rsa AAAA...'
write_files:
@avoidik
avoidik / README.md
Last active May 13, 2021 10:47
How to integrate dnsmasq into systemd dns resolver

Default resolv.conf path

$ ls -ld /etc/resolv.conf
lrwxrwxrwx 1 root root 39 Dec 23 07:45 /etc/resolv.conf -> ../run/systemd/resolve/stub-resolv.conf

Find all open DNS ports

@avoidik
avoidik / kcgroups.md
Created April 24, 2021 21:10 — forked from mcastelino/kcgroups.md
Kubernetes and cgroups Resource Management/Static cpuManagerPolicy/Memory and Resource Isolation & Scheduling

Overview

The goal of this document to cover all aspects of Kubernetes management, including how resources are expressed, constrained and accounted for. This started a way to ensure that alternate container runtime implementation like Kata containers will behave from a resource accounting and consumption point of view in the same manner as runc.

Location of the latest version of this document: https://gist.github.com/mcastelino/b8ce9a70b00ee56036dadd70ded53e9f

If you do not understand cgroups please refer to a quick primer at the bottom of this document. This will help you understand how the resource enforcement actually works.

Kubernetes Resource Management