DNS / DHCP / Nagios / Gammu / Asterisk / MusicPlayerDaemon / Arduino RaspberryPI / OpenVPN | Créer son image pour Raspberry PI | DJI Fade | Reolink Timelapse | K8S on Raspberry Pi
k8s-1 10.1.1.17 k8s-2 10.1.1.15 k8s-3 10.1.1.19 k8s-4 10.1.1.16
Follow pikube/readme.md
apt -y install iptables apt-transport-https gnupg2 software-properties-common apt-transport-https ca-certificates curl vim git
swapoff -a
sudo dphys-swapfile swapoff && sudo dphys-swapfile uninstall && sudo systemctl disable dphys-swapfileupdate-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacytee /etc/modules-load.d/k8s.conf <<EOF
overlay
br_netfilter
EOF
modprobe overlay
modprobe br_netfiltervi /boot/firmware/cmdline.txt
# add the following to the end
cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1tee /etc/sysctl.d/kubernetes.conf <<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
sysctl --systemREBOOT
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/debian.gpg
add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt update
apt install -y containerd.ioKUBE_VER="v1.29"
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/$KUBE_VER/deb/ /" | tee /etc/apt/sources.list.d/kubernetes.list
curl -fsSL https://pkgs.k8s.io/core:/stable:/$KUBE_VER/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpgkubectl version --client
kubeadm version
Master Only
Your Kubernetes control-plane has initialized successfully!
To start using your cluster, you need to run the following as a regular user:
mkdir -p $HOME/.kube sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config sudo chown (id − u):(id -g) $HOME/.kube/config
Alternatively, if you are the root user, you can run:
export KUBECONFIG=/etc/kubernetes/admin.conf
You should now deploy a pod network to the cluster. Run “kubectl apply -f [podnetwork].yaml” with one of the options listed at: https://kubernetes.io/docs/concepts/cluster-administration/addons/
Then you can join any number of worker nodes by running the following on each as root:
kubeadm join 10.1.1.17:6443 –token THE_TOKEN –discovery-token-ca-cert-hash sha256:THE_TOKEN_HASH
apt -y install iptables apt-transport-https gnupg2 software-properties-common apt-transport-https ca-certificates curl vim git
swapoff -a
sudo dphys-swapfile swapoff && sudo dphys-swapfile uninstall && sudo systemctl disable dphys-swapfileupdate-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacytee /etc/modules-load.d/k8s.conf <<EOF
overlay
br_netfilter
EOF
modprobe overlay
modprobe br_netfiltervi /boot/firmware/cmdline.txt
# add the following to the end
cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1tee /etc/sysctl.d/kubernetes.conf <<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
sysctl --systemREBOOT
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/debian.gpg
add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt update
apt install -y containerd.ioKUBE_VER="v1.29"
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/$KUBE_VER/deb/ /" | tee /etc/apt/sources.list.d/kubernetes.list
curl -fsSL https://pkgs.k8s.io/core:/stable:/$KUBE_VER/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpgkubectl version --client
kubeadm version
kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-1 Ready control-plane 53m v1.29.4
raspberrypi Ready <none> 44s v1.29.4kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-1 Ready control-plane 54m v1.29.4
raspberrypi Ready worker 109s v1.29.4apt -y install iptables apt-transport-https gnupg2 software-properties-common apt-transport-https ca-certificates curl vim git
swapoff -a
sudo dphys-swapfile swapoff && sudo dphys-swapfile uninstall && sudo systemctl disable dphys-swapfileupdate-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacytee /etc/modules-load.d/k8s.conf <<EOF
overlay
br_netfilter
EOF
modprobe overlay
modprobe br_netfiltervi /boot/firmware/cmdline.txt
# add the following to the end
cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1tee /etc/sysctl.d/kubernetes.conf <<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
sysctl --systemREBOOT
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/debian.gpg
add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt update
apt install -y containerd.ioKUBE_VER="v1.29"
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/$KUBE_VER/deb/ /" | tee /etc/apt/sources.list.d/kubernetes.list
curl -fsSL https://pkgs.k8s.io/core:/stable:/$KUBE_VER/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpgkubectl version --client
kubeadm version
kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-1 Ready control-plane 70m v1.29.4
k8s-3 NotReady <none> 8s v1.29.4
raspberrypi Ready worker 17m v1.29.4kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-1 Ready control-plane 71m v1.29.4
k8s-3 Ready worker 51s v1.29.4
raspberrypi Ready worker 18m v1.29.4apt -y install iptables apt-transport-https gnupg2 software-properties-common apt-transport-https ca-certificates curl vim git
swapoff -a
sudo dphys-swapfile swapoff && sudo dphys-swapfile uninstall && sudo systemctl disable dphys-swapfileupdate-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacytee /etc/modules-load.d/k8s.conf <<EOF
overlay
br_netfilter
EOF
modprobe overlay
modprobe br_netfiltervi /boot/firmware/cmdline.txt
# add the following to the end
cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1tee /etc/sysctl.d/kubernetes.conf <<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
sysctl --systemREBOOT
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/debian.gpg
add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt update
apt install -y containerd.ioKUBE_VER="v1.29"
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/$KUBE_VER/deb/ /" | tee /etc/apt/sources.list.d/kubernetes.list
curl -fsSL https://pkgs.k8s.io/core:/stable:/$KUBE_VER/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpgkubectl version --client
kubeadm version
kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-1 Ready control-plane 72m v1.29.4
k8s-3 Ready worker 2m v1.29.4
k8s-4 NotReady <none> 8s v1.29.4
raspberrypi Ready worker 19m v1.29.4kubectl get nodes
NAME STATUS ROLES AGE VERSION
k8s-1 Ready control-plane 72m v1.29.4
k8s-3 Ready worker 2m22s v1.29.4
k8s-4 NotReady worker 30s v1.29.4
raspberrypi Ready worker 19m v1.29.4apt -y install iptables apt-transport-https gnupg2 software-properties-common apt-transport-https ca-certificates curl vim git
swapoff -a
sudo dphys-swapfile swapoff && sudo dphys-swapfile uninstall && sudo systemctl disable dphys-swapfileupdate-alternatives --set iptables /usr/sbin/iptables-legacy
update-alternatives --set ip6tables /usr/sbin/ip6tables-legacytee /etc/modules-load.d/k8s.conf <<EOF
overlay
br_netfilter
EOF
modprobe overlay
modprobe br_netfiltervi /boot/firmware/cmdline.txt
# add the following to the end
cgroup_enable=cpuset cgroup_enable=memory cgroup_memory=1tee /etc/sysctl.d/kubernetes.conf <<EOF
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
EOF
sysctl --systemREBOOT
curl -fsSL https://download.docker.com/linux/debian/gpg | gpg --dearmor -o /etc/apt/trusted.gpg.d/debian.gpg
add-apt-repository "deb [arch=$(dpkg --print-architecture)] https://download.docker.com/linux/debian $(lsb_release -cs) stable"
apt update
apt install -y containerd.ioKUBE_VER="v1.29"
echo "deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/$KUBE_VER/deb/ /" | tee /etc/apt/sources.list.d/kubernetes.list
curl -fsSL https://pkgs.k8s.io/core:/stable:/$KUBE_VER/deb/Release.key | gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpgkubectl version --client
kubeadm version
sudo apt install docker-ce docker-ce-cli containerd.io
You must then retrieve the /etc/kubernetes/admin.conf file from master node and transfer it to k8s-cli in ~/pikube.config then modify the .bashrc file to add the command
File nginx-pod.yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx-pod
spec:
containers:
- name: nginx-container
image: nginx
ports:
- containerPort: 80kubectl get pod -A -o wide
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
default nginx-pod 1/1 Running 0 23h 10.244.2.3 k8s-3 <none> <none>from one of the cluster nodes
root@k8s-1:~# wget http://10.244.2.3
--2024-05-08 10:13:49-- http://10.244.2.3/
Connecting to 10.244.2.3:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 615 [text/html]
Saving to: ‘index.html’
index.html 100%[================================================================================================================>] 615 --.-KB/s in 0s
2024-05-08 10:13:49 (23.7 MB/s) - ‘index.html’ saved [615/615]
root@k8s-1:~# cat index.html
<!DOCTYPE html>
<html>
<head>
<title>Welcome to nginx!</title>
<style>
html { color-scheme: light dark; }
body { width: 35em; margin: 0 auto;
font-family: Tahoma, Verdana, Arial, sans-serif; }
</style>
</head>
<body>
<h1>Welcome to nginx!</h1>
<p>If you see this page, the nginx web server is successfully installed and
working. Further configuration is required.</p>
<p>For online documentation and support please refer to
<a href="http://nginx.org/">nginx.org</a>.<br/>
Commercial support is available at
<a href="http://nginx.com/">nginx.com</a>.</p>
<p><em>Thank you for using nginx.</em></p>
</body>
</html>
create folder && cd folder extract all html png files
create Dockerfile
Create Account Validate Account Create Token
File nginx-s3c-pod-ptro.yaml
apiVersion: v1
kind: Pod
metadata:
name: nginx-s3c-pod-ptro
labels:
app: nginx
spec:
containers:
- name: nginx
image: ptro64/mon-nginx:1.0.0
ports:
- containerPort: 80kubectl get pod -A -o wide
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
default nginx-pod 1/1 Running 0 23h 10.244.2.3 k8s-3 <none> <none>
default nginx-s3c-pod-ptro 1/1 Running 0 17h 10.244.1.3 raspberrypi <none> <none>from one of the cluster nodes
root@k8s-1:~# wget http://10.244.1.3
--2024-05-08 10:26:14-- http://10.244.1.3/
Connecting to 10.244.1.3:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1117 (1.1K) [text/html]
Saving to: ‘index.html’
index.html 100%[================================================================================================================>] 1.09K --.-KB/s in 0s
2024-05-08 10:26:14 (99.2 MB/s) - ‘index.html’ saved [1117/1117]
root@k8s-1:~# cat index.html
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Programme rasssemblement de la Braunhie du 8 au 9 Juin 2024</title>
<style>
/* Styles généraux */
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
.container {
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
img {
max-width: 100%;
height: auto;
display: block;
margin-bottom: 20px;
}
/* Media queries pour les écrans de petite taille */
@media only screen and (max-width: 600px) {
.container {
padding: 10px;
}
}
</style>
</head>
<body>
<div class="container">
<div>
<img src="programme-rassemblement-1.png" alt="Programme 1">
</div>
<div>
<img src="programme-rassemblement-2.png" alt="Programme 2">
</div>
</div>
</body>
</html>https://metallb.universe.tf/installation/
kubectl edit configmap -n kube-system kube-proxy
apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
mode: "ipvs"
ipvs:
strictARP: truekubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.14.5/config/manifests/metallb-native.yaml# kubectl get service -A -o wide
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
default kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 2d20h <none>
kube-system kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP,9153/TCP 2d20h k8s-app=kube-dns
metallb-system metallb-webhook-service ClusterIP 10.105.162.12 <none> 443/TCP 102s component=controllerFile metallb.yaml
apiVersion: metallb.io/v1beta1
kind: IPAddressPool
metadata:
name: first-pool
namespace: metallb-system
spec:
addresses:
- 10.1.1.200-10.1.1.250# kubectl get ipaddresspool -n metallb-system
NAME AUTO ASSIGN AVOID BUGGY IPS ADDRESSES
first-pool true false ["10.1.1.200-10.1.1.250"]# kubectl describe ipaddresspool first-pool -n metallb-system
Name: first-pool
Namespace: metallb-system
Labels: <none>
Annotations: <none>
API Version: metallb.io/v1beta1
Kind: IPAddressPool
Metadata:
Creation Timestamp: 2024-05-08T12:35:32Z
Generation: 1
Resource Version: 394321
UID: 539542cd-8797-496e-970b-3ec312ff4b52
Spec:
Addresses:
10.1.1.200-10.1.1.250
Auto Assign: true
Avoid Buggy I Ps: false
Events: <none># kubectl get pods -n metallb-system
NAME READY STATUS RESTARTS AGE
controller-56bb48dcd4-zg577 1/1 Running 0 12m
speaker-48bvw 1/1 Running 0 12m
speaker-cc564 1/1 Running 0 12m
speaker-d8gpb 1/1 Running 0 12m
speaker-w9r97 1/1 Running 0 12mFile nginx-s3c-service.yaml
apiVersion: v1
kind: Service
metadata:
name: nginx-s3c-service
spec:
selector:
app: nginx
pod-name: nginx-s3c-pod-ptro
ports:
- protocol: TCP
port: 80
targetPort: 80
type: LoadBalancer# kubectl get service -A -o wide
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
default kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 2d21h <none>
default nginx-s3c-service LoadBalancer 10.101.62.37 10.1.1.200 80:32746/TCP 2m41s app=nginx,pod-name=nginx-s3c-pod-ptro
kube-system kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP,9153/TCP 2d21h k8s-app=kube-dns
metallb-system metallb-webhook-service ClusterIP 10.105.162.12 <none> 443/TCP 19m component=controller# wget http://10.1.1.200
--2024-05-08 13:45:17-- http://10.1.1.200/
Connecting to 10.1.1.200:80... failed: No route to host.# kubectl get pod -A -o wide
NAMESPACE NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES
default nginx-pod 1/1 Running 0 26h 10.244.2.3 k8s-3 <none> <none>
default nginx-s3c-pod-ptro 1/1 Running 0 20h 10.244.1.3 raspberrypi <none> <none>
kube-flannel kube-flannel-ds-2lnpp 1/1 Running 1 (46h ago) 2d19h 10.1.1.16 k8s-4 <none> <none>
kube-flannel kube-flannel-ds-bqx4z 1/1 Running 1 (46h ago) 2d19h 10.1.1.19 k8s-3 <none> <none>
kube-flannel kube-flannel-ds-glnlk 1/1 Running 1 (46h ago) 2d20h 10.1.1.15 raspberrypi <none> <none>
kube-flannel kube-flannel-ds-s8wrc 1/1 Running 1 (46h ago) 2d20h 10.1.1.17 k8s-1 <none> <none>
kube-system coredns-76f75df574-jhnlh 1/1 Running 1 (46h ago) 2d20h 10.244.0.4 k8s-1 <none> <none>
kube-system coredns-76f75df574-rrj46 1/1 Running 1 (46h ago) 2d20h 10.244.0.5 k8s-1 <none> <none>
kube-system etcd-k8s-1 1/1 Running 1 (46h ago) 2d20h 10.1.1.17 k8s-1 <none> <none>
kube-system kube-apiserver-k8s-1 1/1 Running 1 (46h ago) 2d20h 10.1.1.17 k8s-1 <none> <none>
kube-system kube-controller-manager-k8s-1 1/1 Running 1 (46h ago) 2d20h 10.1.1.17 k8s-1 <none> <none>
kube-system kube-proxy-89kkv 1/1 Running 1 (46h ago) 2d20h 10.1.1.17 k8s-1 <none> <none>
kube-system kube-proxy-p8tjs 1/1 Running 1 (46h ago) 2d19h 10.1.1.19 k8s-3 <none> <none>
kube-system kube-proxy-rwq89 1/1 Running 1 (46h ago) 2d20h 10.1.1.15 raspberrypi <none> <none>
kube-system kube-proxy-rxss8 1/1 Running 1 (46h ago) 2d19h 10.1.1.16 k8s-4 <none> <none>
kube-system kube-scheduler-k8s-1 1/1 Running 1 (46h ago) 2d20h 10.1.1.17 k8s-1 <none> <none>
metallb-system controller-56bb48dcd4-zg577 1/1 Running 0 13m 10.244.3.5 k8s-4 <none> <none>
metallb-system speaker-48bvw 1/1 Running 0 13m 10.1.1.15 raspberrypi <none> <none>
metallb-system speaker-cc564 1/1 Running 0 13m 10.1.1.19 k8s-3 <none> <none>
metallb-system speaker-d8gpb 1/1 Running 0 13m 10.1.1.16 k8s-4 <none> <none>
metallb-system speaker-w9r97 1/1 Running 0 13m 10.1.1.17 k8s-1 <none> <none># kubectl get service -A -o wide
NAMESPACE NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE SELECTOR
default kubernetes ClusterIP 10.96.0.1 <none> 443/TCP 2d17h <none>
kube-system kube-dns ClusterIP 10.96.0.10 <none> 53/UDP,53/TCP,9153/TCP 2d17h k8s-app=kube-dns
kubectl get deployment -A -o wide
NAMESPACE NAME READY UP-TO-DATE AVAILABLE AGE CONTAINERS IMAGES SELECTOR
kube-system coredns 2/2 2 2 2d17h coredns registry.k8s.io/coredns/coredns:v1.11.1 k8s-app=kube-dns
DNS / DHCP / Nagios / Gammu / Asterisk / MusicPlayerDaemon / Arduino RaspberryPI / OpenVPN | Créer son image pour Raspberry PI | DJI Fade | Reolink Timelapse | K8S on Raspberry Pi