Compare commits
17 Commits
kvm-clones
...
Kubeadm_1_
| Author | SHA1 | Date | |
|---|---|---|---|
| 0f880b4d91 | |||
| beed20ea37 | |||
| bb1b54b32e | |||
| d0f40d8157 | |||
| e61a54a23a | |||
| 317061526a | |||
| a40d8210a6 | |||
| 963569e324 | |||
| d0236ad079 | |||
| 37ced0534d | |||
| 03fe3c8ab9 | |||
| 297c4a8459 | |||
| e217a003f2 | |||
| 1535a55316 | |||
| 67629ca840 | |||
| 9e9efba5c3 | |||
| ce332cd791 |
@@ -3,4 +3,82 @@
|
|||||||
*Prep*
|
*Prep*
|
||||||
Install the base OS.
|
Install the base OS.
|
||||||
Install all required apps
|
Install all required apps
|
||||||
Install all required updates
|
* openssh-server
|
||||||
|
Install all required updates
|
||||||
|
|
||||||
|
Shutdown guest
|
||||||
|
* virsh shotdown $guest-vm
|
||||||
|
|
||||||
|
|
||||||
|
On the VM Host server make sure you have libgustsfs-tools
|
||||||
|
|
||||||
|
```
|
||||||
|
apt list --installed |grep -i libguestfs-tools
|
||||||
|
```
|
||||||
|
|
||||||
|
if its not there, install it.
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo apt install libguestfs-tools
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
This step strips stuff that must be unique per VM (machine-id, SSH keys, etc.) from the *template*.
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo virt-sysprep -d $guest-vm \
|
||||||
|
--operations machine-id,ssh-hostkeys,udev-persistent-net,logfiles,tmp-files
|
||||||
|
```
|
||||||
|
|
||||||
|
Your output should be similiar to the following:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo virt-sysprep -d Debian-Base --operations machine-id,ssh-hostkeys,udev-persistent-net,logfiles,tmp-files
|
||||||
|
[ 0.0] Examining the guest ...
|
||||||
|
[ 17.4] Performing "logfiles" ...
|
||||||
|
[ 17.6] Performing "machine-id" ...
|
||||||
|
[ 17.6] Performing "ssh-hostkeys" ...
|
||||||
|
[ 17.6] Performing "tmp-files" ...
|
||||||
|
[ 17.6] Performing "udev-persistent-net" ...
|
||||||
|
```
|
||||||
|
|
||||||
|
The base is now ready to go.
|
||||||
|
|
||||||
|
**Create Clone**
|
||||||
|
|
||||||
|
sudo virt-clone --original $guest-vm \
|
||||||
|
--name guest-01 \
|
||||||
|
--auto-clone
|
||||||
|
|
||||||
|
example
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo virt-clone --original Debian-Base \
|
||||||
|
--name Node01 \
|
||||||
|
--auto-clone
|
||||||
|
Allocating 'Node01.qcow2' | 1.6 GB 00:00:03 ...
|
||||||
|
|
||||||
|
Clone 'Node01' created successfully
|
||||||
|
```
|
||||||
|
|
||||||
|
Confirm your clones have been made
|
||||||
|
|
||||||
|
```
|
||||||
|
virsh list --all
|
||||||
|
Id Name State
|
||||||
|
---------------------------------
|
||||||
|
1 downloads running
|
||||||
|
- Debian-Base shut off
|
||||||
|
- k8s-node1 shut off
|
||||||
|
- k8s-node2 shut off
|
||||||
|
- k8s-node3 shut off
|
||||||
|
- k8s-node4 shut off
|
||||||
|
- k8s-node5 shut off
|
||||||
|
- Node01 shut off
|
||||||
|
- Node02 shut off
|
||||||
|
- Node03 shut off
|
||||||
|
- Node04 shut off
|
||||||
|
- Node05 shut off
|
||||||
|
- Ubuntu_Default shut off
|
||||||
|
|
||||||
|
```
|
||||||
129
Networking/Debian-Static_IP.md
Normal file
129
Networking/Debian-Static_IP.md
Normal file
@@ -0,0 +1,129 @@
|
|||||||
|
**Debian Specific Static IP Address Setup**
|
||||||
|
|
||||||
|
Get the interface name by looking at
|
||||||
|
|
||||||
|
```
|
||||||
|
ip a
|
||||||
|
```
|
||||||
|
|
||||||
|
Example - here the interface we are targeting is enp1s0
|
||||||
|
|
||||||
|
```
|
||||||
|
~$ ip a
|
||||||
|
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
|
||||||
|
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
|
||||||
|
inet 127.0.0.1/8 scope host lo
|
||||||
|
valid_lft forever preferred_lft forever
|
||||||
|
inet6 ::1/128 scope host noprefixroute
|
||||||
|
valid_lft forever preferred_lft forever
|
||||||
|
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
|
||||||
|
link/ether 52:54:00:0c:f6:e7 brd ff:ff:ff:ff:ff:ff
|
||||||
|
altname enx5254000cf6e7
|
||||||
|
inet 192.168.50.80/24 brd 192.168.50.255 scope global dynamic noprefixroute enp1s0
|
||||||
|
valid_lft 85984sec preferred_lft 75184sec
|
||||||
|
inet6 2404:4400:4181:9200:5054:ff:fe0c:f6e7/64 scope global dynamic mngtmpaddr proto kernel_ra
|
||||||
|
valid_lft 86366sec preferred_lft 86366sec
|
||||||
|
inet6 2404:4400:4181:9200:617f:906e:3877:3f00/64 scope global dynamic mngtmpaddr noprefixroute
|
||||||
|
valid_lft 86366sec preferred_lft 86366sec
|
||||||
|
inet6 fe80::b2a2:4462:bece:c8b7/64 scope link
|
||||||
|
valid_lft forever preferred_lft forever
|
||||||
|
~$
|
||||||
|
```
|
||||||
|
|
||||||
|
We will be updated the interfaces file int he networking dir.
|
||||||
|
Before we do anything we always make a backup copy
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo cp /etc/network/interfaces /etc/network/interfaces.bak
|
||||||
|
```
|
||||||
|
|
||||||
|
looking at the interface file its shows that the interface is set to dynamic
|
||||||
|
|
||||||
|
** Orginal interface file
|
||||||
|
|
||||||
|
```
|
||||||
|
# This file describes the network interfaces available on your system
|
||||||
|
# and how to activate them. For more information, see interfaces(5).
|
||||||
|
|
||||||
|
source /etc/network/interfaces.d/*
|
||||||
|
|
||||||
|
# The loopback network interface
|
||||||
|
auto lo
|
||||||
|
iface lo inet loopback
|
||||||
|
|
||||||
|
# The primary network interface
|
||||||
|
allow-hotplug enp1s0
|
||||||
|
iface enp1s0 inet dhcp
|
||||||
|
# This is an autoconfigured IPv6 interface
|
||||||
|
iface enp1s0 inet6 auto
|
||||||
|
```
|
||||||
|
|
||||||
|
We will update the ***face enp1s0 inet dhcp***
|
||||||
|
|
||||||
|
section to look like this
|
||||||
|
|
||||||
|
Example of updated file
|
||||||
|
```
|
||||||
|
# This file describes the network interfaces available on your system
|
||||||
|
# and how to activate them. For more information, see interfaces(5).
|
||||||
|
|
||||||
|
source /etc/network/interfaces.d/*
|
||||||
|
|
||||||
|
# The loopback network interface
|
||||||
|
auto lo
|
||||||
|
iface lo inet loopback
|
||||||
|
|
||||||
|
# The primary network interface
|
||||||
|
allow-hotplug enp1s0
|
||||||
|
iface enp1s0 inet static
|
||||||
|
address 192.168.50.20
|
||||||
|
netmask 255.255.255.0
|
||||||
|
gateway 192.168.50.254
|
||||||
|
dns-nameservers 192.168.50.254 8.8.8.8
|
||||||
|
# This is an autoconfigured IPv6 interface
|
||||||
|
iface enp1s0 inet6 auto
|
||||||
|
```
|
||||||
|
|
||||||
|
After you have made this edit you can restart the service to get the new IP address
|
||||||
|
|
||||||
|
```
|
||||||
|
luddie@Node1-master:~$ ip a
|
||||||
|
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
|
||||||
|
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
|
||||||
|
inet 127.0.0.1/8 scope host lo
|
||||||
|
valid_lft forever preferred_lft forever
|
||||||
|
inet6 ::1/128 scope host noprefixroute
|
||||||
|
valid_lft forever preferred_lft forever
|
||||||
|
2: enp1s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
|
||||||
|
link/ether 52:54:00:0c:f6:e7 brd ff:ff:ff:ff:ff:ff
|
||||||
|
altname enx5254000cf6e7
|
||||||
|
inet 192.168.50.20/24 brd 192.168.50.255 scope global enp1s0
|
||||||
|
valid_lft forever preferred_lft forever
|
||||||
|
inet 192.168.50.80/24 brd 192.168.50.255 scope global secondary dynamic noprefixroute enp1s0
|
||||||
|
valid_lft 86372sec preferred_lft 75572sec
|
||||||
|
inet6 2404:4400:4181:9200:617f:906e:3877:3f00/64 scope global dynamic mngtmpaddr noprefixroute
|
||||||
|
valid_lft 86369sec preferred_lft 86369sec
|
||||||
|
inet6 2404:4400:4181:9200:5054:ff:fe0c:f6e7/64 scope global dynamic mngtmpaddr proto kernel_ra
|
||||||
|
valid_lft 86369sec preferred_lft 86369sec
|
||||||
|
inet6 fe80::b2a2:4462:bece:c8b7/64 scope link
|
||||||
|
valid_lft forever preferred_lft forever
|
||||||
|
luddie@Node1-master:~$
|
||||||
|
```
|
||||||
|
|
||||||
|
The network is now available via the updated ip address... HOWEVER did you see the old IP is still there?
|
||||||
|
|
||||||
|
```
|
||||||
|
inet 192.168.50.80/24 brd 192.168.50.255 scope global secondary dynamic noprefixroute enp1s0
|
||||||
|
valid_lft 86372sec preferred_lft 75572sec
|
||||||
|
```
|
||||||
|
|
||||||
|
Easiest way of dealing with this...
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo reboot
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
And when the machine comes back up, ssh using the newly statically assigned IP address.
|
||||||
|
|
||||||
|
Update - Dont forget to updated the /etc/resolve.conf with your nameserver address
|
||||||
53
Networking/Hostname.md
Normal file
53
Networking/Hostname.md
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
**Setup Hostname**
|
||||||
|
|
||||||
|
Log into the hostname (ssh)
|
||||||
|
|
||||||
|
Run the following command
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo hostnamectl set-hostname NewHostName
|
||||||
|
```
|
||||||
|
|
||||||
|
Also need to update the hosts name
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo vi /etc/hosts
|
||||||
|
```
|
||||||
|
|
||||||
|
***Example of old host file***
|
||||||
|
|
||||||
|
```
|
||||||
|
127.0.0.1 localhost
|
||||||
|
127.0.1.1 old-hostname.vocus.co.nz old-hostname
|
||||||
|
|
||||||
|
# The following lines are desirable for IPv6 capable hosts
|
||||||
|
::1 localhost ip6-localhost ip6-loopback
|
||||||
|
ff02::1 ip6-allnodes
|
||||||
|
ff02::2 ip6-allrouters
|
||||||
|
```
|
||||||
|
|
||||||
|
***Example of updated host***
|
||||||
|
|
||||||
|
```
|
||||||
|
127.0.0.1 localhost
|
||||||
|
127.0.1.1 New-hostname.vocus.co.nz New-hostname
|
||||||
|
|
||||||
|
# The following lines are desirable for IPv6 capable hosts
|
||||||
|
::1 localhost ip6-localhost ip6-loopback
|
||||||
|
ff02::1 ip6-allnodes
|
||||||
|
ff02::2 ip6-allrouters
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
While hostnamectl typically applies the changes immediately, some services or applications might still be referencing the old hostname. You can restart network services or reboot the system for a complete refresh, although often it's not strictly necessary.
|
||||||
|
To restart network services:
|
||||||
|
|
||||||
|
```
|
||||||
|
sudo systemctl restart network-online.target
|
||||||
|
```
|
||||||
|
|
||||||
|
or just reboot
|
||||||
|
|
||||||
|
```
|
||||||
|
Sudo Reboot
|
||||||
|
```
|
||||||
34
Networking/k8s/kubeadmin_install/Install_Instruction.md
Normal file
34
Networking/k8s/kubeadmin_install/Install_Instruction.md
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
**Installing k8s with kubeadm**
|
||||||
|
|
||||||
|
kubeadm join 192.168.50.20:6443 --token 72ckd0.rnphe03eqa135cjj \
|
||||||
|
--discovery-token-ca-cert-hash sha256:75add2111581b5b0a4a074f3748c46b67be82d246f110e557be049da0ef44941
|
||||||
|
|
||||||
|
|
||||||
|
worker node
|
||||||
|
|
||||||
|
container runtime
|
||||||
|
|
||||||
|
wget https://github.com/containerd/containerd/releases/download/v2.2.0/containerd-2.2.0-linux-amd64.tar.gz
|
||||||
|
|
||||||
|
download the systemctl
|
||||||
|
https://raw.githubusercontent.com/containerd/containerd/main/containerd.service
|
||||||
|
and move it to
|
||||||
|
|
||||||
|
sudo cp containerd.service /usr/lib/systemd/system
|
||||||
|
|
||||||
|
runc
|
||||||
|
download
|
||||||
|
https://github.com/opencontainers/runc/releases/download/v1.4.0/runc.amd64
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sudo mkdir -p /etc/containerd
|
||||||
|
sudo containerd config default | sudo tee /etc/containerd/config.toml
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
sudo cat <<EOF | sudo tee /etc/sysctl.d/k8s.conf
|
||||||
|
net.ipv4.ip_forward = 1
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sudo sysctl --system
|
||||||
2
Networking/k8s/kubeadmin_install/add_users.md
Normal file
2
Networking/k8s/kubeadmin_install/add_users.md
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
lol
|
||||||
|
|
||||||
53
SSH/keygen.md
Normal file
53
SSH/keygen.md
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
**SSH Key Gen**
|
||||||
|
After a fresh install we want to generate an SSH key pair (public and private)
|
||||||
|
we can then use this key to ssh onto hosts without having to share passwords.
|
||||||
|
|
||||||
|
On the new host
|
||||||
|
|
||||||
|
```
|
||||||
|
ssh-keygen -t ecdsa
|
||||||
|
```
|
||||||
|
|
||||||
|
You could add a -C for comment and then add your emaiul address but... meh
|
||||||
|
|
||||||
|
|
||||||
|
Example
|
||||||
|
|
||||||
|
```
|
||||||
|
~$ ssh-keygen -t ecdsa
|
||||||
|
Generating public/private ecdsa key pair.
|
||||||
|
Enter file in which to save the key (/home/luddie/.ssh/id_ecdsa):
|
||||||
|
Created directory '/home/luddie/.ssh'.
|
||||||
|
Enter passphrase for "/home/luddie/.ssh/id_ecdsa" (empty for no passphrase):
|
||||||
|
Enter same passphrase again:
|
||||||
|
Your identification has been saved in /home/luddie/.ssh/id_ecdsa
|
||||||
|
Your public key has been saved in /home/luddie/.ssh/id_ecdsa.pub
|
||||||
|
The key fingerprint is:
|
||||||
|
SHA256:gA+5oVKPdtlG7JQC5pL3NQ+OokUK7WoosTevWBCd1E0 luddie@debian-base
|
||||||
|
The key's randomart image is:
|
||||||
|
+---[ECDSA 256]---+
|
||||||
|
| +. oE |
|
||||||
|
| B o.+.. |
|
||||||
|
|= 1 * X |
|
||||||
|
|.O = / = |
|
||||||
|
|B = B * S |
|
||||||
|
|.X o . |
|
||||||
|
|*.+ |
|
||||||
|
|o+ o |
|
||||||
|
|. ... |
|
||||||
|
+----[SHA256]-----+
|
||||||
|
~$
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
This will generate 2 keys in the .ssh folder
|
||||||
|
|
||||||
|
```
|
||||||
|
~/.ssh$ ls
|
||||||
|
id_ecdsa id_ecdsa.pub
|
||||||
|
~/.ssh$
|
||||||
|
```
|
||||||
|
|
||||||
|
Use can then cat the .pub file to get the public keyu for that host, which can be added to the authorized_host file of other machines to gain access.
|
||||||
|
|
||||||
|
You can also create an authorized_keys on your cost, and add other ssh pub key to allow them to have direct access to this host.
|
||||||
Reference in New Issue
Block a user