Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
if [ -z "$1" ] ;
then
echo Specify a virtual-machine name.
exit 1
fi
sudo virt-install \
--name $1 \
#!/bin/bash
function install_packages() {
packages=( $@ )
sudo apt update
sudo apt install --no-install-recommends -y ${packages[@]}
}
function create_dir() {
dir_list=( $@ )
@sidarta-luizalabs
sidarta-luizalabs / chroot-to-pi.sh
Created July 7, 2018 00:05 — forked from htruong/chroot-to-pi.sh
Chroot to pi sd card
#!/bin/bash
# This script allows you to chroot ("work on")
# the raspbian sd card as if it's the raspberry pi
# on your Ubuntu desktop/laptop
# just much faster and more convenient
# credits: https://gist.github.com/jkullick/9b02c2061fbdf4a6c4e8a78f1312a689
# make sure you have issued
# 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
@sidarta-luizalabs
sidarta-luizalabs / k8s-pi.md
Created January 1, 2018 22:41 — forked from alexellis/k8s-pi.md
K8s on Raspbian

K8s on (vanilla) Raspbian Lite

Yes - you can create a Kubernetes cluster with Raspberry Pis with the default operating system Raspbian. Carry on using all the tools and packages you're used to with the officially-supported OS.

Pre-reqs:

  • You must use an RPi2 or 3 for Kubernetes
  • I'm assuming you're using wired ethernet (Wi-Fi also works)

Master node setup

@sidarta-luizalabs
sidarta-luizalabs / ansible-summary.md
Created June 13, 2017 02:37 — forked from andreicristianpetcu/ansible-summary.md
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

Ansible execution begins with the script: `bin/ansible`. This script is sym-linked to other names, such as ansible-playbook and ansible-pull, ansible-conneciton being the exception.
When executed, this script looks at the first parameter passed to it. On Linux/Unix systems, this parameter is the name of the script itself. By examining this value, we can determine which CLI class we should load and execute.
Ansible CLI Classes:
- AdHocCLI (the plain "ansible" command)
- PlaybookCLI (when run with "ansible-playbook")
- PullCLI (when run with "ansible-pull")
- DocCLI (when run with "ansible-doc")
- GalaxyCLI (when run with "ansible-galaxy")
lxc list --format=json | jq -r '.[]| select(.status=="Running").state.network.eth0.addresses[0].address + " " + select(.status=="Running").name' | sudo tee -a /etc/hosts
# allowed out
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface eth1 -j ACCEPT
# forward port
iptables -t nat -A PREROUTING -p tcp -d 192.95.39.129 --dport 80 -j DNAT --to-destination 10.0.0.3:80
iptables -t nat -A POSTROUTING -p tcp -d 10.0.0.3 --dport 80 -j SNAT --to-source 10.0.0.1
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo apt-get install oracle-java7-set-default