initial VM config
This commit is contained in:
parent
7efa164eb8
commit
c4807b7d37
13 changed files with 357 additions and 0 deletions
119
contrib/k8s.txt
Normal file
119
contrib/k8s.txt
Normal file
|
@ -0,0 +1,119 @@
|
||||||
|
### Keyboard config
|
||||||
|
d-i debian-installer/locale string en_US.UTF-8
|
||||||
|
d-i keyboard-configuration/variant select American English
|
||||||
|
d-i keyboard-configuration/xkb-keymap select us
|
||||||
|
d-i keyboard-configuration/toggle select No toggling
|
||||||
|
|
||||||
|
### Network configuration
|
||||||
|
d-i netcfg/choose_interface select auto
|
||||||
|
d-i netcfg/get_hostname string unassigned-hostname
|
||||||
|
d-i netcfg/get_domain string unassigned-domain
|
||||||
|
d-i netcfg/hostname string k8s-demo
|
||||||
|
d-i netcfg/wireless_wep string
|
||||||
|
d-i netcfg/dhcp_hostname string k8s-demo
|
||||||
|
d-i hw-detect/load_firmware boolean true
|
||||||
|
|
||||||
|
### Mirror settings
|
||||||
|
d-i mirror/country string manual
|
||||||
|
d-i mirror/http/hostname string cdn.debian.net
|
||||||
|
d-i mirror/http/directory string /debian
|
||||||
|
d-i mirror/http/proxy string
|
||||||
|
|
||||||
|
### Account setup
|
||||||
|
d-i passwd/root-login boolean false
|
||||||
|
|
||||||
|
# To create a normal user account.
|
||||||
|
d-i passwd/user-fullname string K8S Admin
|
||||||
|
d-i passwd/username string k8s
|
||||||
|
d-i passwd/user-password password K8Sdemo
|
||||||
|
d-i passwd/user-password-again password K8Sdemo
|
||||||
|
|
||||||
|
# The user account will be added to some standard initial groups. To
|
||||||
|
# override that, use this.
|
||||||
|
#d-i passwd/user-default-groups string audio cdrom video
|
||||||
|
|
||||||
|
### Clock and time zone setup
|
||||||
|
d-i clock-setup/utc boolean true
|
||||||
|
d-i time/zone string UTC
|
||||||
|
d-i clock-setup/ntp boolean true
|
||||||
|
d-i clock-setup/ntp-server string clock.ix.gs
|
||||||
|
|
||||||
|
### Partitioning
|
||||||
|
d-i partman-auto/method string lvm
|
||||||
|
d-i partman-lvm/device_remove_lvm boolean true
|
||||||
|
d-i partman-md/device_remove_md boolean true
|
||||||
|
d-i partman-lvm/confirm boolean true
|
||||||
|
d-i partman-lvm/confirm_nooverwrite boolean true
|
||||||
|
d-i partman-auto/choose_recipe select atomic
|
||||||
|
d-i partman-basicfilesystems/no_swap boolean true
|
||||||
|
d-i partman-lvm/expert_recipe string \
|
||||||
|
boot-root :: \
|
||||||
|
250 50 1000 xfs \
|
||||||
|
$primary{ } $bootable{ } \
|
||||||
|
method{ format } format{ } \
|
||||||
|
use_filesystem{ } filesystem{ xfs } \
|
||||||
|
mountpoint{ /boot } \
|
||||||
|
. \
|
||||||
|
5000 10000 1000000000 xfs \
|
||||||
|
method{ format } format{ } \
|
||||||
|
use_filesystem{ } filesystem{ xfs } \
|
||||||
|
mountpoint{ / } \
|
||||||
|
.
|
||||||
|
|
||||||
|
d-i partman-partitioning/confirm_write_new_label boolean true
|
||||||
|
d-i partman/choose_partition select finish
|
||||||
|
d-i partman/confirm boolean true
|
||||||
|
d-i partman/confirm_nooverwrite boolean true
|
||||||
|
|
||||||
|
### Apt setup
|
||||||
|
d-i apt-setup/non-free boolean true
|
||||||
|
d-i apt-setup/contrib boolean true
|
||||||
|
d-i debian-installer/allow_unauthenticated boolean true
|
||||||
|
|
||||||
|
|
||||||
|
### Package selection
|
||||||
|
tasksel tasksel/first multiselect none, ssh-server, standard
|
||||||
|
|
||||||
|
# Individual additional packages to install
|
||||||
|
d-i pkgsel/include string \
|
||||||
|
apt-transport-https gnupg2 ca-certificates curl \
|
||||||
|
iptables linux-headers-amd64
|
||||||
|
|
||||||
|
# Whether to upgrade packages after debootstrap.
|
||||||
|
# Allowed values: none, safe-upgrade, full-upgrade
|
||||||
|
d-i pkgsel/upgrade select full-upgrade
|
||||||
|
popularity-contest popularity-contest/participate boolean true
|
||||||
|
|
||||||
|
### Boot loader installation
|
||||||
|
d-i grub-installer/only_debian boolean true
|
||||||
|
d-i grub-installer/with_other_os boolean true
|
||||||
|
d-i grub-installer/bootdev string default
|
||||||
|
|
||||||
|
### Finishing up the installation
|
||||||
|
d-i finish-install/reboot_in_progress note
|
||||||
|
d-i debian-installer/exit/poweroff boolean true
|
||||||
|
|
||||||
|
#### Advanced options
|
||||||
|
### Running custom commands during the installation
|
||||||
|
d-i preseed/late_command string in-target /bin/sh -c " \
|
||||||
|
echo k8s-demo > /etc/hostname; \
|
||||||
|
update-alternatives --set iptables /usr/sbin/iptables-legacy ; \
|
||||||
|
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy ; \
|
||||||
|
update-alternatives --set arptables /usr/sbin/arptables-legacy ; \
|
||||||
|
update-alternatives --set ebtables /usr/sbin/ebtables-legacy ; \
|
||||||
|
( systemctl disable nftables && systemctl mask nftables ) ; \
|
||||||
|
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add - ; \
|
||||||
|
curl -s https://download.docker.com/linux/debian/gpg | sudo apt-key add - ; \
|
||||||
|
echo 'deb https://apt.kubernetes.io/ kubernetes-xenial main' >/etc/apt/sources.list.d/kubernetes.list ; \
|
||||||
|
echo 'deb [arch=amd64] https://download.docker.com/linux/debian/ stretch stable' >/etc/apt/sources.list.d/docker.list ; \
|
||||||
|
apt-get update ; \
|
||||||
|
apt-get install -y \
|
||||||
|
docker-ce docker-ce-cli containerd.io \
|
||||||
|
kubelet kubeadm kubectl ; \
|
||||||
|
apt-mark hold \
|
||||||
|
docker-ce docker-ce-cli containerd.io \
|
||||||
|
kubelet kubeadm kubectl ; \
|
||||||
|
apt-get clean ; \
|
||||||
|
systemctl enable serial-getty@ttyS0.service; \
|
||||||
|
systemctl enable docker.service ; \
|
||||||
|
|| true"
|
BIN
contrib/mood.it
Normal file
BIN
contrib/mood.it
Normal file
Binary file not shown.
BIN
contrib/qemu-system-x86_64
Executable file
BIN
contrib/qemu-system-x86_64
Executable file
Binary file not shown.
BIN
contrib/share/qemu/bios-256k.bin
Normal file
BIN
contrib/share/qemu/bios-256k.bin
Normal file
Binary file not shown.
BIN
contrib/share/qemu/efi-e1000.rom
Normal file
BIN
contrib/share/qemu/efi-e1000.rom
Normal file
Binary file not shown.
157
contrib/share/qemu/keymaps/common
Normal file
157
contrib/share/qemu/keymaps/common
Normal file
|
@ -0,0 +1,157 @@
|
||||||
|
include modifiers
|
||||||
|
|
||||||
|
#
|
||||||
|
# Top row
|
||||||
|
#
|
||||||
|
1 0x2
|
||||||
|
2 0x3
|
||||||
|
3 0x4
|
||||||
|
4 0x5
|
||||||
|
5 0x6
|
||||||
|
6 0x7
|
||||||
|
7 0x8
|
||||||
|
8 0x9
|
||||||
|
9 0xa
|
||||||
|
0 0xb
|
||||||
|
BackSpace 0xe
|
||||||
|
|
||||||
|
#
|
||||||
|
# QWERTY first row
|
||||||
|
#
|
||||||
|
Tab 0xf localstate
|
||||||
|
ISO_Left_Tab 0xf shift
|
||||||
|
q 0x10 addupper
|
||||||
|
w 0x11 addupper
|
||||||
|
e 0x12 addupper
|
||||||
|
r 0x13 addupper
|
||||||
|
t 0x14 addupper
|
||||||
|
y 0x15 addupper
|
||||||
|
u 0x16 addupper
|
||||||
|
i 0x17 addupper
|
||||||
|
o 0x18 addupper
|
||||||
|
p 0x19 addupper
|
||||||
|
|
||||||
|
#
|
||||||
|
# QWERTY second row
|
||||||
|
#
|
||||||
|
a 0x1e addupper
|
||||||
|
s 0x1f addupper
|
||||||
|
d 0x20 addupper
|
||||||
|
f 0x21 addupper
|
||||||
|
g 0x22 addupper
|
||||||
|
h 0x23 addupper
|
||||||
|
j 0x24 addupper
|
||||||
|
k 0x25 addupper
|
||||||
|
l 0x26 addupper
|
||||||
|
Return 0x1c localstate
|
||||||
|
|
||||||
|
#
|
||||||
|
# QWERTY third row
|
||||||
|
#
|
||||||
|
z 0x2c addupper
|
||||||
|
x 0x2d addupper
|
||||||
|
c 0x2e addupper
|
||||||
|
v 0x2f addupper
|
||||||
|
b 0x30 addupper
|
||||||
|
n 0x31 addupper
|
||||||
|
m 0x32 addupper
|
||||||
|
|
||||||
|
space 0x39 localstate
|
||||||
|
|
||||||
|
less 0x56
|
||||||
|
greater 0x56 shift
|
||||||
|
bar 0x56 altgr
|
||||||
|
brokenbar 0x56 shift altgr
|
||||||
|
|
||||||
|
#
|
||||||
|
# Esc and Function keys
|
||||||
|
#
|
||||||
|
Escape 0x1 localstate
|
||||||
|
F1 0x3b localstate
|
||||||
|
F2 0x3c localstate
|
||||||
|
F3 0x3d localstate
|
||||||
|
F4 0x3e localstate
|
||||||
|
F5 0x3f localstate
|
||||||
|
F6 0x40 localstate
|
||||||
|
F7 0x41 localstate
|
||||||
|
F8 0x42 localstate
|
||||||
|
F9 0x43 localstate
|
||||||
|
F10 0x44 localstate
|
||||||
|
F11 0x57 localstate
|
||||||
|
F12 0x58 localstate
|
||||||
|
|
||||||
|
# Printscreen, Scrollock and Pause
|
||||||
|
# Printscreen really requires four scancodes (0xe0, 0x2a, 0xe0, 0x37),
|
||||||
|
# but (0xe0, 0x37) seems to work.
|
||||||
|
Print 0xb7 localstate
|
||||||
|
Sys_Req 0xb7 localstate
|
||||||
|
Execute 0xb7 localstate
|
||||||
|
Scroll_Lock 0x46
|
||||||
|
|
||||||
|
#
|
||||||
|
# Insert - PgDown
|
||||||
|
#
|
||||||
|
Insert 0xd2 localstate
|
||||||
|
Delete 0xd3 localstate
|
||||||
|
Home 0xc7 localstate
|
||||||
|
End 0xcf localstate
|
||||||
|
Page_Up 0xc9 localstate
|
||||||
|
Page_Down 0xd1 localstate
|
||||||
|
|
||||||
|
#
|
||||||
|
# Arrow keys
|
||||||
|
#
|
||||||
|
Left 0xcb localstate
|
||||||
|
Up 0xc8 localstate
|
||||||
|
Down 0xd0 localstate
|
||||||
|
Right 0xcd localstate
|
||||||
|
|
||||||
|
#
|
||||||
|
# Numpad
|
||||||
|
#
|
||||||
|
Num_Lock 0x45
|
||||||
|
KP_Divide 0xb5
|
||||||
|
KP_Multiply 0x37
|
||||||
|
KP_Subtract 0x4a
|
||||||
|
KP_Add 0x4e
|
||||||
|
KP_Enter 0x9c
|
||||||
|
|
||||||
|
KP_Decimal 0x53 numlock
|
||||||
|
KP_Separator 0x53 numlock
|
||||||
|
KP_Delete 0x53
|
||||||
|
|
||||||
|
KP_0 0x52 numlock
|
||||||
|
KP_Insert 0x52
|
||||||
|
|
||||||
|
KP_1 0x4f numlock
|
||||||
|
KP_End 0x4f
|
||||||
|
|
||||||
|
KP_2 0x50 numlock
|
||||||
|
KP_Down 0x50
|
||||||
|
|
||||||
|
KP_3 0x51 numlock
|
||||||
|
KP_Next 0x51
|
||||||
|
|
||||||
|
KP_4 0x4b numlock
|
||||||
|
KP_Left 0x4b
|
||||||
|
|
||||||
|
KP_5 0x4c numlock
|
||||||
|
KP_Begin 0x4c
|
||||||
|
|
||||||
|
KP_6 0x4d numlock
|
||||||
|
KP_Right 0x4d
|
||||||
|
|
||||||
|
KP_7 0x47 numlock
|
||||||
|
KP_Home 0x47
|
||||||
|
|
||||||
|
KP_8 0x48 numlock
|
||||||
|
KP_Up 0x48
|
||||||
|
|
||||||
|
KP_9 0x49 numlock
|
||||||
|
KP_Prior 0x49
|
||||||
|
|
||||||
|
Caps_Lock 0x3a
|
||||||
|
#
|
||||||
|
# Inhibited keys
|
||||||
|
#
|
||||||
|
Multi_key 0x0 inhibit
|
35
contrib/share/qemu/keymaps/en-us
Normal file
35
contrib/share/qemu/keymaps/en-us
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
# generated from XKB map us
|
||||||
|
include common
|
||||||
|
map 0x409
|
||||||
|
exclam 0x02 shift
|
||||||
|
at 0x03 shift
|
||||||
|
numbersign 0x04 shift
|
||||||
|
dollar 0x05 shift
|
||||||
|
percent 0x06 shift
|
||||||
|
asciicircum 0x07 shift
|
||||||
|
ampersand 0x08 shift
|
||||||
|
asterisk 0x09 shift
|
||||||
|
parenleft 0x0a shift
|
||||||
|
parenright 0x0b shift
|
||||||
|
minus 0x0c
|
||||||
|
underscore 0x0c shift
|
||||||
|
equal 0x0d
|
||||||
|
plus 0x0d shift
|
||||||
|
bracketleft 0x1a
|
||||||
|
braceleft 0x1a shift
|
||||||
|
bracketright 0x1b
|
||||||
|
braceright 0x1b shift
|
||||||
|
semicolon 0x27
|
||||||
|
colon 0x27 shift
|
||||||
|
apostrophe 0x28
|
||||||
|
quotedbl 0x28 shift
|
||||||
|
grave 0x29
|
||||||
|
asciitilde 0x29 shift
|
||||||
|
backslash 0x2b
|
||||||
|
bar 0x2b shift
|
||||||
|
comma 0x33
|
||||||
|
less 0x33 shift
|
||||||
|
period 0x34
|
||||||
|
greater 0x34 shift
|
||||||
|
slash 0x35
|
||||||
|
question 0x35 shift
|
18
contrib/share/qemu/keymaps/modifiers
Normal file
18
contrib/share/qemu/keymaps/modifiers
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
Shift_R 0x36
|
||||||
|
Shift_L 0x2a
|
||||||
|
|
||||||
|
Alt_R 0xb8
|
||||||
|
Mode_switch 0xb8
|
||||||
|
ISO_Level3_Shift 0xb8
|
||||||
|
Alt_L 0x38
|
||||||
|
|
||||||
|
Control_R 0x9d
|
||||||
|
Control_L 0x1d
|
||||||
|
|
||||||
|
# Translate Super to Windows keys.
|
||||||
|
# This is hardcoded. See documentation for details.
|
||||||
|
Super_R 0xdc
|
||||||
|
Super_L 0xdb
|
||||||
|
|
||||||
|
# Translate Menu to the Windows Application key.
|
||||||
|
Menu 0xdd
|
BIN
contrib/share/qemu/kvmvapic.bin
Normal file
BIN
contrib/share/qemu/kvmvapic.bin
Normal file
Binary file not shown.
BIN
contrib/share/qemu/linuxboot.bin
Normal file
BIN
contrib/share/qemu/linuxboot.bin
Normal file
Binary file not shown.
BIN
contrib/share/qemu/vgabios-stdvga.bin
Normal file
BIN
contrib/share/qemu/vgabios-stdvga.bin
Normal file
Binary file not shown.
28
runme.sh
Executable file
28
runme.sh
Executable file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/bash
|
||||||
|
appdir=$(cd `dirname $0` && pwd)
|
||||||
|
apptmp='/dev/shm'
|
||||||
|
vmsize='4G'
|
||||||
|
vmmem='2G'
|
||||||
|
k8sdsk="${apptmp}/k8s.raw"
|
||||||
|
httpboot='http://ftp.debian.org/debian/dists/stretch/main/installer-amd64/current/images/netboot/debian-installer/amd64/'
|
||||||
|
seed='https://gist.githubusercontent.com/D4rk4/7612b96985d088769f60cda958dcf9e2/raw/68ad4e82743ddc80ebd1c534bb48150eeb31a5a6/preseed-k8s.txt'
|
||||||
|
qemu="${appdir}/contrib/qemu-system-x86_64 -L ${appdir}/contrib/share/qemu -net nic -net user -m ${vmmem} -localtime -enable-kvm -cpu host,+nx -M pc -smp 2 -vga std -usbdevice tablet -k en-us -hda ${k8sdsk} -boot once=d -nographic"
|
||||||
|
###
|
||||||
|
installvm() {
|
||||||
|
fallocate -l ${vmsize} ${k8sdsk}
|
||||||
|
echo "Preparing K8S VM..."
|
||||||
|
wget -cO ${apptmp}/kernel ${httpboot}/linux
|
||||||
|
wget -cO ${apptmp}/initrd ${httpboot}/initrd.gz
|
||||||
|
${qemu} -kernel ${apptmp}/kernel -initrd ${apptmp}/initrd -append "console=ttyS0,115200n8 apt-setup/proposed=true nomodeset fb=false priority=critical locale=en_US url=${seed}"
|
||||||
|
}
|
||||||
|
runvm() {
|
||||||
|
echo "Look like we already has VM, let's go"
|
||||||
|
${qemu}
|
||||||
|
}
|
||||||
|
###
|
||||||
|
if [ ! -f "${k8sdsk}" ]; then
|
||||||
|
installvm;
|
||||||
|
runvm;
|
||||||
|
else
|
||||||
|
runvm;
|
||||||
|
fi
|
Loading…
Add table
Add a link
Reference in a new issue