Skip to content

Instantly share code, notes, and snippets.

View krisnova's full-sized avatar
😅
busy keeping this website online

Kris Nóva krisnova

😅
busy keeping this website online
View GitHub Profile

Kubernetes 1.17 on AWS with Cilium and Falco from scratch

Use these kubeadm configs and watch the live stream for more information on how to set up Kubernetes 1.17 on AWS with Cilium and Falco.

Master node

Kubeadm config

@leodido
leodido / kubectl-exec-node.sh
Last active March 26, 2020 19:02
Exec into a node with kubectl
#!/usr/bin/env bash
NODE=kind-control-plane
IMG="docker.io/library/alpine"
POD="nsenter-$(tr -dc a-z0-9 < /dev/urandom | head -c 6)"
OVERRIDE="{\"spec\":{\"nodeName\":\"$NODE\",\"hostPID\":true,\"containers\":[{\"securityContext\":{\"privileged\":true},\"image\":\"${IMG}\",\"name\":\"nsenter\",\"stdin\":true,\"stdinOnce\":true,\"tty\":true,\"command\":[\"nsenter\",\"--target\",\"1\",\"--mount\",\"--uts\",\"--ipc\",\"--net\",\"--pid\",\"--\",\"bash\",\"-l\"]}]}}"
kubectl run --rm \
--image "${IMG}" \
--overrides="${OVERRIDE}" \
# Apply the metallb manifests to Kubernetes
kubectl apply -f https://raw.githubusercontent.com/google/metallb/v0.8.1/manifests/metallb.yaml
# Apply a metallb configuration to Kubernetes
cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: ConfigMap
metadata:
namespace: metallb-system
name: config
@StephenSorriaux
StephenSorriaux / install-kubernetes-archlinux.md
Created October 25, 2018 18:47
Install Kubernetes on bare-metal ArchLinux host

Installing Kubernetes on ArchLinux

Packages

pacman -S curl docker ebtables ethtool wget unzip

Also cfssl is needed but available on AUR, using pacaur

pacaur -S cfssl
# This tells kubecfg to read its config from the local directory
export KUBECONFIG=./kubeconfig
# Looking at the cluster
kubectl get nodes
kubectl get pods --namespace=kube-system
# Running a single pod
kubectl run --generator=run-pod/v1 --image=gcr.io/kuar-demo/kuard-amd64:1 kuard
kubectl get pods
@louisrawlins
louisrawlins / restore_file_from_chrome_cache
Last active November 27, 2016 23:13
Restore cache files from hex generated by Chrome (chrome://cache)
#!/bin/sh
#
# Just run this command (usage notes below):
pbpaste | xxd -r - FILENAME.EXT
# Script: restore_file_from_chrome_cache
# Author: Louis Rawlins (email@louisrawlins.com)
# Date: November 17, 2016 at 4:35:39 PM PST
# Description: Restore cache files from hex generated by Chrome (chrome://cache)
@kokjo
kokjo / sendfd.c
Last active April 16, 2024 10:27
Send a file descriptor over an abstract unix domain socket
// compile with: gcc -static -o sendfd sendfd.c
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <strings.h>
int send_fd(int sock, int fd){
// This function does the arcane magic for sending
// file descriptors over unix domain sockets
struct msghdr msg;

There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.

All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.

  1. Loop variables are scoped outside the loop.

What do these lines do? Make predictions and then scroll down.

func print(pi *int) { fmt.Println(*pi) }
@eelsivart
eelsivart / heartbleed.py
Last active June 7, 2024 02:16 — forked from sh1n0b1/ssltest.py
Heartbleed (CVE-2014-0160) Test & Exploit Python Script
#!/usr/bin/python
# Modified by Travis Lee
# Last Updated: 4/21/14
# Version 1.16
#
# -changed output to display text only instead of hexdump and made it easier to read
# -added option to specify number of times to connect to server (to get more data)
# -added option to send STARTTLS command for use with SMTP/POP/IMAP/FTP/etc...
# -added option to specify an input file of multiple hosts, line delimited, with or without a port specified (host:port)
@sh1n0b1
sh1n0b1 / ssltest.py
Created April 8, 2014 07:53
Python Heartbleed (CVE-2014-0160) Proof of Concept
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select