From de21e876d6160fda97db87c57f993be987f11fb3 Mon Sep 17 00:00:00 2001 From: Gitea Actions Date: Fri, 18 Jul 2025 08:23:42 +0000 Subject: [PATCH] Auto-update blog content from Obsidian: 2025-07-18 08:23:42 --- ...te-manual-kubernetes-cluster-kubeadm.fr.md | 4 +- ...reate-manual-kubernetes-cluster-kubeadm.md | 95 ++++++++++++++++++- 2 files changed, 95 insertions(+), 4 deletions(-) diff --git a/content/post/8-create-manual-kubernetes-cluster-kubeadm.fr.md b/content/post/8-create-manual-kubernetes-cluster-kubeadm.fr.md index b8fff08..4d362be 100644 --- a/content/post/8-create-manual-kubernetes-cluster-kubeadm.fr.md +++ b/content/post/8-create-manual-kubernetes-cluster-kubeadm.fr.md @@ -190,7 +190,7 @@ Une fois tous les nœuds préparés, on peut initialiser le **plan de contrôle* Exécutez la commande suivante pour amorcer le cluster: ```bash sudo kubeadm init \ - --control-plane-endpoint "k8s_lab.lab.vezpi.me:6443" \ + --control-plane-endpoint "k8s-lab.lab.vezpi.me:6443" \ --upload-certs \ --pod-network-cidr=10.10.0.0/16 ``` @@ -200,7 +200,7 @@ sudo kubeadm init \ - `--upload-certs` : Télécharge les certificats qui doivent être partagés entre toutes les masters du cluster. - `--pod-network-cidr` : Sous-réseau à utiliser pour le CNI. -ℹ️ Le nom DNS `k8s_lab.lab.vezpi.me` est géré dans mon homelab par **Unbound DNS**, cela résout sur mon interface d'**OPNsense** où un service **HAProxy** écoute sur le port 6443 et équilibre la charge entre les 3 nœuds du plan de contrôle. +ℹ️ Le nom DNS `k8s-lab.lab.vezpi.me` est géré dans mon homelab par **Unbound DNS**, cela résout sur mon interface d'**OPNsense** où un service **HAProxy** écoute sur le port 6443 et équilibre la charge entre les 3 nœuds du plan de contrôle. Cette étape va : - Initialiser la base `etcd` et les composants du plan de contrôle. diff --git a/content/post/8-create-manual-kubernetes-cluster-kubeadm.md b/content/post/8-create-manual-kubernetes-cluster-kubeadm.md index 190ed1b..013b121 100644 --- a/content/post/8-create-manual-kubernetes-cluster-kubeadm.md +++ b/content/post/8-create-manual-kubernetes-cluster-kubeadm.md @@ -190,7 +190,7 @@ Once all nodes are prepared, it’s time to initialize the Kubernetes control pl Run the following command to bootstrap the cluster: ```bash sudo kubeadm init \ - --control-plane-endpoint "k8s_lab.lab.vezpi.me:6443" \ + --control-plane-endpoint "k8s-lab.lab.vezpi.me:6443" \ --upload-certs \ --pod-network-cidr=10.10.0.0/16 ``` @@ -200,7 +200,7 @@ sudo kubeadm init \ - `--upload-certs`: Upload the certificates that should be shared across all masters of the cluster. - `--pod-network-cidr`: Subnet for the CNI. -ℹ️ The DNS name `k8s_lab.lab.vezpi.me` is handled in my homelab by **Unbound DNS**, this resolves on my **OPNsense** interface where a **HAProxy** service listen on the port 6443 and load balance between the 3 control plane nodes. +ℹ️ The DNS name `k8s-lab.lab.vezpi.me` is handled in my homelab by **Unbound DNS**, this resolves on my **OPNsense** interface where a **HAProxy** service listen on the port 6443 and load balance between the 3 control plane nodes. This step will: - Initialize the `etcd` database and control plane components. @@ -209,6 +209,97 @@ This step will: You’ll also see a message instructing you to set up your `kubectl` access. +```plaintext +I0718 07:18:29.306814 14724 version.go:261] remote version is much newer: v1.33.3; falling back to: stable-1.32 +[init] Using Kubernetes version: v1.32.7 +[preflight] Running pre-flight checks +[preflight] Pulling images required for setting up a Kubernetes cluster +[preflight] This might take a minute or two, depending on the speed of your internet connection +[preflight] You can also perform this action beforehand using 'kubeadm config images pull' +W0718 07:18:29.736833 14724 checks.go:846] detected that the sandbox image "registry.k8s.io/pause:3.8" of the container runtime is inconsistent with that used by kubeadm.It is recommended to use "registry.k8s.io/pause:3.10" as the CRI sandbox image. +[certs] Using certificateDir folder "/etc/kubernetes/pki" +[certs] Generating "ca" certificate and key +[certs] Generating "apiserver" certificate and key +[certs] apiserver serving cert is signed for DNS names [apex-master k8s-lab.lab.vezpi.me kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 192.168.66.167] +[certs] Generating "apiserver-kubelet-client" certificate and key +[certs] Generating "front-proxy-ca" certificate and key +[certs] Generating "front-proxy-client" certificate and key +[certs] Generating "etcd/ca" certificate and key +[certs] Generating "etcd/server" certificate and key +[certs] etcd/server serving cert is signed for DNS names [apex-master localhost] and IPs [192.168.66.167 127.0.0.1 ::1] +[certs] Generating "etcd/peer" certificate and key +[certs] etcd/peer serving cert is signed for DNS names [apex-master localhost] and IPs [192.168.66.167 127.0.0.1 ::1] +[certs] Generating "etcd/healthcheck-client" certificate and key +[certs] Generating "apiserver-etcd-client" certificate and key +[certs] Generating "sa" key and public key +[kubeconfig] Using kubeconfig folder "/etc/kubernetes" +[kubeconfig] Writing "admin.conf" kubeconfig file +[kubeconfig] Writing "super-admin.conf" kubeconfig file +[kubeconfig] Writing "kubelet.conf" kubeconfig file +[kubeconfig] Writing "controller-manager.conf" kubeconfig file +[kubeconfig] Writing "scheduler.conf" kubeconfig file +[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests" +[control-plane] Using manifest folder "/etc/kubernetes/manifests" +[control-plane] Creating static Pod manifest for "kube-apiserver" +[control-plane] Creating static Pod manifest for "kube-controller-manager" +[control-plane] Creating static Pod manifest for "kube-scheduler" +[kubelet-start] Writing kubelet environment file with flags to file "/var/lib/kubelet/kubeadm-flags.env" +[kubelet-start] Writing kubelet configuration to file "/var/lib/kubelet/config.yaml" +[kubelet-start] Starting the kubelet +[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests" +[kubelet-check] Waiting for a healthy kubelet at http://127.0.0.1:10248/healthz. This can take up to 4m0s +[kubelet-check] The kubelet is healthy after 501.894876ms +[api-check] Waiting for a healthy API server. This can take up to 4m0s +[api-check] The API server is healthy after 9.030595455s +[upload-config] Storing the configuration used in ConfigMap "kubeadm-config" in the "kube-system" Namespace +[kubelet] Creating a ConfigMap "kubelet-config" in namespace kube-system with the configuration for the kubelets in the cluster +[upload-certs] Storing the certificates in Secret "kubeadm-certs" in the "kube-system" Namespace +[upload-certs] Using certificate key: +70614009469f9fc7a97c392253492c509f1884281f59ccd7725b3200e3271794 +[mark-control-plane] Marking the node apex-master as control-plane by adding the labels: [node-role.kubernetes.io/control-plane node.kubernetes.io/exclude-from-external-load-balancers] +[mark-control-plane] Marking the node apex-master as control-plane by adding the taints [node-role.kubernetes.io/control-plane:NoSchedule] +[bootstrap-token] Using token: 8etamd.g8whseg60kg09nu1 +[bootstrap-token] Configuring bootstrap tokens, cluster-info ConfigMap, RBAC Roles +[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to get nodes +[bootstrap-token] Configured RBAC rules to allow Node Bootstrap tokens to post CSRs in order for nodes to get long term certificate credentials +[bootstrap-token] Configured RBAC rules to allow the csrapprover controller automatically approve CSRs from a Node Bootstrap Token +[bootstrap-token] Configured RBAC rules to allow certificate rotation for all node client certificates in the cluster +[bootstrap-token] Creating the "cluster-info" ConfigMap in the "kube-public" namespace +[kubelet-finalize] Updating "/etc/kubernetes/kubelet.conf" to point to a rotatable kubelet client certificate and key +[addons] Applied essential addon: CoreDNS +[addons] Applied essential addon: kube-proxy + +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/ + +You can now join any number of control-plane nodes running the following command on each as root: + + kubeadm join k8s-lab.lab.vezpi.me:6443 --token 8etamd.g8whseg60kg09nu1 \ + --discovery-token-ca-cert-hash sha256:65c4da3121f57d2e67ea6c1c1349544c9e295d78790b199b5c3be908ffe5ed6c \ + --control-plane --certificate-key 70614009469f9fc7a97c392253492c509f1884281f59ccd7725b3200e3271794 + +Please note that the certificate-key gives access to cluster sensitive data, keep it secret! +As a safeguard, uploaded-certs will be deleted in two hours; If necessary, you can use +"kubeadm init phase upload-certs --upload-certs" to reload certs afterward. + +Then you can join any number of worker nodes by running the following on each as root: + +kubeadm join k8s-lab.lab.vezpi.me:6443 --token 8etamd.g8whseg60kg09nu1 \ + --discovery-token-ca-cert-hash sha256:65c4da3121f57d2e67ea6c1c1349544c9e295d78790b199b5c3be908ffe5ed6c +``` ### Configure `kubectl` If you want to manage your cluster from your master node, you can simply copy paste from the output of the `kubeadm init` command: