Skip to content

Instantly share code, notes, and snippets.

@hkwi
Last active December 14, 2018 10:12
Show Gist options
  • Save hkwi/8b6a2ec96e7f711e727f70f11d7b8753 to your computer and use it in GitHub Desktop.
Save hkwi/8b6a2ec96e7f711e727f70f11d7b8753 to your computer and use it in GitHub Desktop.
kubeadm init --pod-network-cidr 10.244.0.0/16
sysctl net.bridge.bridge-nf-call-iptables=1
# disable control plane isolation
kubectl taint nodes --all node-role.kubernetes.io/master-
# flannel
kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/bc79dd1505b0c8681ece4de4c0d86c5cd2643275/Documentation/kube-flannel.yml
#cloud-config
# cc_set_passwords
password: hogehoge
chpasswd:
expire: False
ssh_pwauth: True
# cc_package_update_upgrade_install
package_update: True
package_upgrade: True
package_reboot_if_required: True
packages:
- docker.io
# cc_power_state_change
power_state:
mode: poweroff
apt-get update && apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
# https://github.com/kubernetes/kubernetes/issues/66300
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update
apt-get install -y kubelet kubeadm
import sys
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
if len(sys.argv) == 1:
print("%s input-file:type ..." % (sys.argv[0]))
sys.exit(1)
combined_message = MIMEMultipart()
for i in sys.argv[1:]:
(filename, format_type) = i.split(":", 1)
with open(filename) as fh:
contents = fh.read()
sub_message = MIMEText(contents, format_type, "us-ascii")
sub_message.add_header('Content-Disposition', 'attachment; filename="%s"' % (filename))
combined_message.attach(sub_message)
print(combined_message)
lxc remote list
lxc remote add osk1 192.168.0.111
lxc list osk1:
# lxc image list ubuntu:
lxc init ubuntu:bionic osk1:x1
lxc config set osk1:x1 security.nesting true
lxc config set osk1:x1 volatile.eth0.hwaddr 00:00:00:00:02:01
## https://github.com/lxc/lxd/blob/master/doc/cloud-init.md
lxc config set osk1:x1 user.network-config - <<EOF
version: 1
config:
- type: physical
name: eth0
mac_address: "00:00:00:00:02:01"
subnets:
- type: static
address: 10.76.215.11
netmask: 255.255.255.0
gateway: 10.76.215.1
- type: nameserver
address: 10.76.215.1
EOF
python seed.py base.cfg:cloud-config base.sh:x-shellscript | lxc config set osk1:x1 user.user-data -
lxc start osk1:x1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment