Skip to content

Instantly share code, notes, and snippets.

@lalyos
lalyos / Dockerfile
Last active April 8, 2024 19:31
Dockerfile failing on server, but builds locally
FROM tianon/centos
MAINTAINER SequenceIQ
# install dev tools
RUN yum install -y openssh-server openssh-clients
# passwordless ssh
RUN ssh-keygen -q -N "" -t dsa -f /etc/ssh/ssh_host_dsa_key
RUN ssh-keygen -q -N "" -t rsa -f /etc/ssh/ssh_host_rsa_key
RUN ssh-keygen -q -N "" -t rsa -f /root/.ssh/id_rsa
@lalyos
lalyos / etcd-list-keys.md
Last active March 27, 2024 19:25
k8s etcd list keys

You can demostrate how kubernetes stores everything in etcd (v3):

One-liner

You can exec etcdctl rigth in the etc pod:

kubectl exec -it \
  -n kube-system etcd-minikube \
  -- sh -c 'ETCDCTL_CACERT=/var/lib/localkube/certs/etcd/ca.crt \
 ETCDCTL_CERT=/var/lib/localkube/certs/etcd/peer.crt \
@lalyos
lalyos / .0README.md
Last active December 14, 2023 13:38
KUBECONFIG helper scripts - magic

Install

Add this to you ~/.bashrc

if [ -f ~/.kube/.kube-config.sh ]; then 
  source ~/.kube/.kube-config.sh
else 
  curl -sLo ~/.kube/.kube-config.sh https://gist.githubusercontent.com/lalyos/f851fd3273fead83146eeca6822a9604/raw/.kube-config.sh
  source ~/.kube/.kube-config.sh
fi
@lalyos
lalyos / README.md
Last active October 13, 2023 19:25
bash script skeleton following https://github.com/progrium/bashstyle

To start a new script use this one-liner:

curl -Lo newscript.sh http://j.mp/bash-skeleton
@lalyos
lalyos / 00-k3s-airgap-images.sh
Last active October 4, 2023 19:47
k3s with airgap image prewarmed
mkdir -p /var/lib/rancher/k3s/agent/images/
VERSION_K3S=$(curl -w '%{url_effective}' -L -s -S https://update.k3s.io/v1-release/channels/stable -o /dev/null | sed -e 's|.*/||')
curl -sL -o /var/lib/rancher/k3s/agent/images/airgap-images.tar https://github.com/k3s-io/k3s/releases/download/${VERSION_K3S}/k3s-airgap-images-amd64.tar
services:
backend:
image: web:v7
build:
context: https://github.com/lalyos/docker-lufi-2023-09-26.git
tags:
- lalyos/web
- ttl.sh/web
environment:
- TITLE=Dinner [dev]
@lalyos
lalyos / compose.yaml
Last active September 15, 2023 08:42
services:
coffee:
image: lalyos/12factor
ports:
- 80
environment:
- TITLE=Coffebreak LEVEL 2.
- COLOR=gray
backend:
image: lalyos/12factor
@lalyos
lalyos / main.go
Last active September 11, 2023 17:44
goplay example
package greet
import (
"fmt"
)
func Greet() {
fmt.Println("Greating from golpay package [gist] ... v1.3")
}
@lalyos
lalyos / README.md
Last active July 27, 2023 11:59
install golang to ubuntu/debian one-linet

Install latest golang

curl -Ls http://bit.ly/go_installer | bash

Overview

If you want to install golang, normally you are following the description on the official dowload page

@lalyos
lalyos / dnstest.go
Created June 13, 2015 08:23
DNS SRV record test in golang
package main
import (
"fmt"
"net"
"os"
)
func main() {
if len(os.Args) < 2 {