在ubuntu 24.04.2 通过 Kubeadm 安装 Kubernetes v1.31.6

文章目录
- 1. 简介
- 2. 准备
- 3. 配置 containerd
- 4. kubeadm 安装集群
- 5. 安装网络 calico 插件
1. 简介
本指南介绍了如何在 Ubuntu 24.04.2 LTS 上安装和配置 Kubernetes 1.31.6 集群,包括容器运行时 containerd 的安装与配置,以及使用 kubeadm 进行集群初始化。
2. 准备
root@ECS-koreacentral-T4:~# hostnamectlStatic hostname: ECS-koreacentral-T4Icon name: computer-vmChassis: vm 🖴Machine ID: c88bb0e23b5541e488ff6c6c5bb305abBoot ID: 9992b6a929f94d86b3e83195008137aeVirtualization: microsoft
Operating System: Ubuntu 24.04.2 LTSKernel: Linux 6.8.0-1021-azureArchitecture: x86-64Hardware Vendor: Microsoft CorporationHardware Model: Virtual Machine
Firmware Version: Hyper-V UEFI Release v4.1Firmware Date: Fri 2024-03-08Firmware Age: 11month 3wroot@ECS-koreacentral-T4:~# freetotal used free shared buff/cache available
Mem: 57585648 1128332 56230412 4124 804752 56457316
Swap: 0 0 0
root@ECS-koreacentral-T4:~# df -Th
Filesystem Type Size Used Avail Use% Mounted on
/dev/root ext4 495G 1.9G 494G 1% /
tmpfs tmpfs 28G 0 28G 0% /dev/shm
tmpfs tmpfs 11G 1.1M 11G 1% /run
tmpfs tmpfs 5.0M 0 5.0M 0% /run/lock
efivarfs efivarfs 128M 26K 128M 1% /sys/firmware/efi/efivars
/dev/sda16 ext4 881M 59M 761M 8% /boot
/dev/sda15 vfat 105M 6.1M 99M 6% /boot/efi
/dev/sdb1 ext4 346G 32K 328G 1% /mnt
tmpfs tmpfs 5.5G 12K 5.5G 1% /run/user/1000
3. 配置 containerd
containerd 是 Kubernetes 推荐的容器运行时。本指南提供了 install-containerd-k8s-v1.31.4.sh 脚本来自动下载并安装所需组件,包括:
- runc
- containerd
- nerdctl
- crictl
- CNI 插件
$ cat install-containerd-k8s-v1.31.4.sh
#!/bin/bashname=`basename $0 .sh`
ENABLE_DOWNLOAD=${ENABLE_DOWNLOAD:-true}
BASE_DIR="$( dirname "$( readlink -f "${0}" )" )"if [ ! -e files ]; thenmkdir -p files
fiFILES_DIR=./files
IMAGES_DIR=./images# download files, if not found
download() {url=$1dir=$2filename=$(basename $1)mkdir -p ${FILES_DIR}/$dirif [ ! -e ${FILES_DIR}/$dir/$filename ]; thenecho "==> download $url"(cd ${FILES_DIR}/$dir && curl -SLO $1)fi
}download_files() {if $ENABLE_DOWNLOAD; then# TODO: These version must be same as kubespray. Refer `roles/downloads/defaults/main.yml` of kubespray.RUNC_VERSION=1.2.3CONTAINERD_VERSION=1.7.24NERDCTL_VERSION=1.7.7CRICTL_VERSION=1.31.1CNI_VERSION=1.4.0download https://github.com/opencontainers/runc/releases/download/v${RUNC_VERSION}/runc.amd64 runc/v${RUNC_VERSION}download https://github.com/containerd/containerd/releases/download/v${CONTAINERD_VERSION}/containerd-${CONTAINERD_VERSION}-linux-amd64.tar.gzdownload https://github.com/containerd/nerdctl/releases/download/v${NERDCTL_VERSION}/nerdctl-${NERDCTL_VERSION}-linux-amd64.tar.gzdownload https://github.com/kubernetes-sigs/cri-tools/releases/download/v${CRICTL_VERSION}/crictl-v${CRICTL_VERSION}-linux-amd64.tar.gzdownload https://github.com/containernetworking/plugins/releases/download/v${CNI_VERSION}/cni-plugins-linux-amd64-v${CNI_VERSION}.tgz kubernetes/cnielseFILES_DIR=./files
fi}select_latest() {local latest=$(ls $* | tail -1)if [ -z "$latest" ]; thenecho "No such file: $*"exit 1fiecho $latest
}install_runc() {# Install runc
echo "==> Install runc"
sudo cp $(select_latest "${FILES_DIR}/runc/v*/runc.amd64") /usr/local/bin/runc
sudo chmod 755 /usr/local/bin/runc}install_nerdctl() {
# Install nerdctl
echo "==> Install nerdctl"
tar xvf $(select_latest "${FILES_DIR}/nerdctl-*-linux-amd64.tar.gz") -C /tmp
sudo cp /tmp/nerdctl /usr/local/bin}install_crictl () {
# Install crictl plugins
echo "==> Install crictl plugins"
sudo tar xvzf $(select_latest "${FILES_DIR}/crictl-v*-linux-amd64.tar.gz") -C /usr/local/bincat > /etc/crictl.yaml <<EOF
runtime-endpoint: unix:///run/containerd/containerd.sock
image-endpoint: unix:///run/containerd/containerd.sock
timeout: 10
debug: false
EOF}install_containerd() {
# Install containerd
echo "==> Install containerd"echo ""
cat <<EOF | sudo tee /etc/modules-load.d/containerd.conf
overlay
br_netfilter
EOF
systemctl restart systemd-modules-load.service
cat <<EOF | sudo tee /etc/sysctl.d/99-kubernetes-cri.conf
net.bridge.bridge-nf-call-iptables = 1
net.ipv4.ip_forward = 1
net.bridge.bridge-nf-call-ip6tables = 1
EOF
sysctl --systemsudo tar xvf $(select_latest "${FILES_DIR}/containerd-*-linux-amd64.tar.gz") --strip-components=1 -C /usr/local/bincat > /etc/systemd/system/containerd.service <<EOF
# Copyright The containerd Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.[Unit]
Description=containerd container runtime
Documentation=https://containerd.io
After=network.target local-fs.target[Service]
ExecStartPre=-/sbin/modprobe overlay
ExecStart=/usr/local/bin/containerdType=notify
Delegate=yes
KillMode=process
Restart=always
RestartSec=5
# Having non-zero Limit*s causes performance problems due to accounting overhead
# in the kernel. We recommend using cgroups to do container-local accounting.
LimitNPROC=infinity
LimitCORE=infinity
LimitNOFILE=infinity
# Comment TasksMax if your systemd version does not supports it.
# Only systemd 226 and above support this version.
TasksMax=infinity
OOMScoreAdjust=-999[Install]
WantedBy=multi-user.target
EOFsudo mkdir -p \/etc/systemd/system/containerd.service.d \/etc/containerd \/var/lib/containerd \/run/containerdcontainerd config default | tee /etc/containerd/config.toml
sed -i "s#SystemdCgroup\ \=\ false#SystemdCgroup\ \=\ true#g" /etc/containerd/config.toml
cat /etc/containerd/config.toml | grep SystemdCgroupecho "==> Start containerd"
sudo systemctl daemon-reload && sudo systemctl enable --now containerd && sudo systemctl restart containerd && sudo systemctl status containerd | grep Active
}install_cni() {
# Install cni plugins
echo "==> Install CNI plugins"
sudo mkdir -p /opt/cni/bin
sudo tar xvzf $(select_latest "${FILES_DIR}/kubernetes/cni/cni-plugins-linux-amd64-v*.tgz") -C /opt/cni/bin}action=$1case $action ind )download_files;;i|install)install_nerdctlinstall_crictlinstall_runcinstall_containerdinstall_cni;;*)echo "Usage: $name [d|i]"echo "sh $name d: it is download packages."echo "sh$name i: it is install packages.";;
esac
exit 0
下载软件
$ sh install-containerd-k8s-v1.31.4.sh d
安装软件
$ sh install-containerd-k8s-v1.31.4.sh i
查看containerd状态
$ systemctl status containerd.service
查看版本
nerdctl --version
crictl --version
runc --version
输出
nerdctl version 1.7.7
crictl version v1.31.1
runc version 1.2.3
commit: v1.2.3-0-g0d37cfd4
spec: 1.2.0
go: go1.22.10
libseccomp: 2.5.5
4. kubeadm 安装集群
sudo apt-get update
sudo apt-get install -y apt-transport-https ca-certificates curl gpg
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.31/deb/Release.key | sudo gpg --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.31/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt-get update
查询版本
root@ECS-koreacentral-T4:~# apt-cache policy kubelet
kubelet:Installed: (none)Candidate: 1.31.6-1.1Version table:1.31.6-1.1 500500 https://pkgs.k8s.io/core:/stable:/v1.31/deb Packages1.31.5-1.1 500500 https://pkgs.k8s.io/core:/stable:/v1.31/deb Packages1.31.4-1.1 500500 https://pkgs.k8s.io/core:/stable:/v1.31/deb Packages1.31.3-1.1 500500 https://pkgs.k8s.io/core:/stable:/v1.31/deb Packages1.31.2-1.1 500500 https://pkgs.k8s.io/core:/stable:/v1.31/deb Packages1.31.1-1.1 500500 https://pkgs.k8s.io/core:/stable:/v1.31/deb Packages1.31.0-1.1 500500 https://pkgs.k8s.io/core:/stable:/v1.31/deb Packages
root@ECS-koreacentral-T4:~# apt-cache policy kubeadm
kubeadm:Installed: (none)Candidate: 1.31.6-1.1Version table:1.31.6-1.1 500500 https://pkgs.k8s.io/core:/stable:/v1.31/deb Packages1.31.5-1.1 500500 https://pkgs.k8s.io/core:/stable:/v1.31/deb Packages1.31.4-1.1 500500 https://pkgs.k8s.io/core:/stable:/v1.31/deb Packages1.31.3-1.1 500500 https://pkgs.k8s.io/core:/stable:/v1.31/deb Packages1.31.2-1.1 500500 https://pkgs.k8s.io/core:/stable:/v1.31/deb Packages1.31.1-1.1 500500 https://pkgs.k8s.io/core:/stable:/v1.31/deb Packages1.31.0-1.1 500500 https://pkgs.k8s.io/core:/stable:/v1.31/deb Packages
root@ECS-koreacentral-T4:~#
安装集群
sudo apt-get -y install kubelet=1.31.6-1.1 kubeadm=1.31.6-1.1 kubectl=1.31.6-1.1
sudo apt-mark hold kubelet kubeadm kubectl
sudo systemctl enable --now kubelet
kubeadm init --kubernetes-version=v1.31.6 --pod-network-cidr=10.96.0.0/12 --apiserver-advertise-address=10.0.0.4
输出:
root@ECS-koreacentral-T4:~# kubeadm init --kubernetes-version=v1.31.6 --pod-network-cidr=10.96.0.0/12 --apiserver-advertise-address=10.0.0.4
[init] Using Kubernetes version: v1.31.6
[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'
W0227 06:11:14.927695 30673 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 [ecs-koreacentral-t4 kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local] and IPs [10.96.0.1 10.0.0.4]
[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 [ecs-koreacentral-t4 localhost] and IPs [10.0.0.4 127.0.0.1 ::1]
[certs] Generating "etcd/peer" certificate and key
[certs] etcd/peer serving cert is signed for DNS names [ecs-koreacentral-t4 localhost] and IPs [10.0.0.4 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 1.001206836s
[api-check] Waiting for a healthy API server. This can take up to 4m0s
[api-check] The API server is healthy after 6.00167991s
[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] Skipping phase. Please see --upload-certs
[mark-control-plane] Marking the node ecs-koreacentral-t4 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 ecs-koreacentral-t4 as control-plane by adding the taints [node-role.kubernetes.io/control-plane:NoSchedule]
[bootstrap-token] Using token: b56uy1.w1v7pe0vuxnrcj42
[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-proxyYour Kubernetes control-plane has initialized successfully!To start using your cluster, you need to run the following as a regular user:mkdir -p $HOME/.kubesudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/configsudo chown $(id -u):$(id -g) $HOME/.kube/configAlternatively, if you are the root user, you can run:export KUBECONFIG=/etc/kubernetes/admin.confYou 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.0.0.4:6443 --token b56uy1.w1v7pe0vuxnrcj42 \--discovery-token-ca-cert-hash sha256:ccbb7ad4040c10bf6e927f30fa7709127f28e3201a3241da8f16af9f3a834940
root@ECS-koreacentral-T4:~#
配置kubeconfig
$ mkdir -p $HOME/.kube
$ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
$ sudo chown $(id -u):$(id -g) $HOME/.kube/config
查看集群状态
root@ECS-koreacentral-T4:~# k get node
NAME STATUS ROLES AGE VERSION
ecs-koreacentral-t4 NotReady control-plane 2m50s v1.31.6
root@ECS-koreacentral-T4:~# kubectl get pod -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system coredns-7c65d6cfc9-cndd5 0/1 Pending 0 3m
kube-system coredns-7c65d6cfc9-zm5wd 0/1 Pending 0 3m
kube-system etcd-ecs-koreacentral-t4 1/1 Running 0 3m6s
kube-system kube-apiserver-ecs-koreacentral-t4 1/1 Running 0 3m6s
kube-system kube-controller-manager-ecs-koreacentral-t4 1/1 Running 0 3m6s
kube-system kube-proxy-mcbt2 1/1 Running 0 3m
kube-system kube-scheduler-ecs-koreacentral-t4 1/1 Running 0 3m6s
5. 安装网络 calico 插件
kubectl apply -f https://docs.projectcalico.org/manifests/calico.yaml
root@ECS-koreacentral-T4:~# k get node
NAME STATUS ROLES AGE VERSION
ecs-koreacentral-t4 Ready control-plane 4m16s v1.31.6
root@ECS-koreacentral-T4:~# k get pod -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system calico-kube-controllers-6879d4fcdc-tlspt 0/1 ContainerCreating 0 27s
kube-system calico-node-fgrvd 0/1 Running 0 27s
kube-system coredns-7c65d6cfc9-cndd5 0/1 ContainerCreating 0 4m14s
kube-system coredns-7c65d6cfc9-zm5wd 0/1 ContainerCreating 0 4m14s
kube-system etcd-ecs-koreacentral-t4 1/1 Running 0 4m20s
kube-system kube-apiserver-ecs-koreacentral-t4 1/1 Running 0 4m20s
kube-system kube-controller-manager-ecs-koreacentral-t4 1/1 Running 0 4m20s
kube-system kube-proxy-mcbt2 1/1 Running 0 4m14s
kube-system kube-scheduler-ecs-koreacentral-t4 1/1 Running 0 4m20s
root@ECS-koreacentral-T4:~# k get pod -A
NAMESPACE NAME READY STATUS RESTARTS AGE
kube-system calico-kube-controllers-6879d4fcdc-tlspt 1/1 Running 0 37s
kube-system calico-node-fgrvd 1/1 Running 0 37s
kube-system coredns-7c65d6cfc9-cndd5 1/1 Running 0 4m24s
kube-system coredns-7c65d6cfc9-zm5wd 1/1 Running 0 4m24s
kube-system etcd-ecs-koreacentral-t4 1/1 Running 0 4m30s
kube-system kube-apiserver-ecs-koreacentral-t4 1/1 Running 0 4m30s
kube-system kube-controller-manager-ecs-koreacentral-t4 1/1 Running 0 4m30s
kube-system kube-proxy-mcbt2 1/1 Running 0 4m24s
kube-system kube-scheduler-ecs-koreacentral-t4 1/1 Running 0 4m30s
参考:
- https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
- https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/create-cluster-kubeadm/
相关文章:
在ubuntu 24.04.2 通过 Kubeadm 安装 Kubernetes v1.31.6
文章目录 1. 简介2. 准备3. 配置 containerd4. kubeadm 安装集群5. 安装网络 calico 插件 1. 简介 本指南介绍了如何在 Ubuntu 24.04.2 LTS 上安装和配置 Kubernetes 1.31.6 集群,包括容器运行时 containerd 的安装与配置,以及使用 kubeadm 进行集群初始…...
DO-254航空标准飞行器电机控制器设计注意事项
DO-254航空标准飞行器电机控制器设计注意事项 1.核心要求1.1 设计保证等级(DAL)划分1.2生命周期管理1.3验证与确认2.电机控制器硬件设计的关键注意事项2.1需求管理与可追溯性2.2冗余与容错设计2.3验证与确认策略2.4元器件选型与管理2.5环境适应性设计2.6文档与配置管理3.应用…...
【Pandas】pandas Series fillna
Pandas2.2 Series Computations descriptive stats 方法描述Series.backfill(*[, axis, inplace, limit, …])用于填充 Series 中缺失值(NaN)的方法Series.bfill(*[, axis, inplace, limit, …])用于填充 Series 中缺失值(NaN)的…...
文字描边实现内黄外绿效果
网页使用 <!DOCTYPE html> <html> <head> <style> .text-effect {color: #ffd700; /* 黄色文字 */-webkit-text-stroke: 2px #008000; /* 绿色描边(兼容Webkit内核) */text-stroke: 2px #008000; /* 标准语法 *…...
解决Deepseek“服务器繁忙,请稍后再试”问题,基于硅基流动和chatbox的解决方案
文章目录 前言操作步骤步骤1:注册账号步骤2:在线体验步骤3:获取API密钥步骤4:安装chatbox步骤5:chatbox设置 价格方面 前言 最近在使用DeepSeek时,开启深度思考功能后,频繁遇到“服务器繁忙&am…...
python-leetcode-使用最小花费爬楼梯
746. 使用最小花费爬楼梯 - 力扣(LeetCode) 解法 1:动态规划(O(n) 时间,O(n) 空间) class Solution:def minCostClimbingStairs(self, cost: List[int]) -> int:n len(cost)dp [0] * (n 1) # 额外多…...
图书数据采集:使用Python爬虫获取书籍详细信息
文章目录 一、准备工作1.1 环境搭建1.2 确定目标网站1.3 分析目标网站二、采集豆瓣读书网站三、处理动态加载的内容四、批量抓取多本书籍信息五、反爬虫策略与应对方法六、数据存储与管理七、总结在数字化时代,图书信息的管理和获取变得尤为重要。通过编写Python爬虫,可以从各…...
ChatGPT 提示词框架
作为一个资深安卓开发工程师,我们在日常开发中经常会用到 ChatGPT 来提升开发效率,比如代码优化、bug 排查、生成单元测试等。 但要想真正发挥 ChatGPT 的潜力,我们需要掌握一些提示词(Prompt)的编写技巧,并…...
【构建工具】Gradle 8中Android BuildConfig的变化与开启方法
随着Gradle 8的发布,Android开发者需要注意一个重要变化:BuildConfig类的生成现在默认被关闭了!!!。这个变化可能会影响许多依赖于BuildConfig的项目(别问,问就是我也被影响了,多好用…...
性能测试测试策略制定|知名软件测评机构经验分享
随着互联网产品的普及,产品面对的用户量级也越来越大,能抗住指数级增长的瞬间访问量以及交易量是保障购物体验是否顺畅的至关重要的一环,而我们的性能测试恰恰也是为此而存在的。 性能测试是什么呢?性能测试要怎么测呢?…...
SAP-ABAP:SAP数据库视图(Database View)详解-创建
在SAP系统中,数据库视图(Database View) 是一种基于物理数据库表的虚拟表,通过关联多个表(使用INNER JOIN)生成逻辑数据集。它存储在数据库中,但本身不存储数据,仅通过查询动态生成结…...
BUG: 解决新版本SpringBoot3.4.3在创建项目时勾选lombok但无法使用的问题
前言 当使用Spring Boot 3.4.3创建新项目时,即使正确勾选Lombok依赖,编译时仍出现找不到符号的错误,但代码中Lombok注解的使用完全正确。 原因 Spring Boot 3.4.3在自动生成的pom.xml中新增了maven-compiler-plugin的配置,该插件…...
登录次数限制
文章目录 一、应用场景与设计目的1. 应用场景2. 设计目的 二、功能设计1. 登录限制规则2. 解锁机制3. 适用维度 三、技术实现1. 数据存储2. 逻辑流程3. 实现代码示例4. 动态锁定时间 四、安全增强与扩展1. 防止用户名枚举2. 加入验证码3. 监控与报警4. 分布式支持 五、设计思考…...
CMU15445(2023fall) Project #2 - Extendible Hash Index 匠心分析
胡未灭,鬓已秋,泪空流 此生谁料 心在天山 身老沧州 ——诉衷情 完整代码见: SnowLegend-star/CMU15445-2023fall: Having Conquered the Loftiest Peak, We Stand But a Step Away from Victory in This Stage. With unwavering determinati…...
排序模板——C++
0.排序模板题目 题目描述 将读入的 N 个数从小到大排序后输出。 输入格式 第一行为一个正整数 N。 第二行包含 N 个空格隔开的正整数 ai,为你需要进行排序的数。 输出格式 将给定的 N 个数从小到大输出,数之间空格隔开,行末换行且无空格。 …...
【Java面试】JVM汇总
目录 1.JVM为什么能跨平台? 2.JVM由哪些部分构成?每个部分起到什么作用? 3.什么是双亲委派?双亲委派的两大作用是什么? 举个例子🌰: 为什么要有这种“家族规矩”? 破坏双亲委派…...
【如何避免dify分类问题总是返回第一个分类错误】
如何用好Dify问题分类器?避开误分类陷阱的实战指南 在大模型应用开发中,问题分类器是构建智能工作流的核心组件。它通过判断用户意图将请求路由至不同处理分支,直接影响系统响应精准度。但在实际使用中,开发者常遇到分类结果总是…...
【SpringBoot】Spring 一站式解决方案:融合统一返回结果、异常处理与适配器模式
前言 ???本期讲解关于统一功能处理的详细介绍~~~ ??感兴趣的小伙伴看一看小编主页:-CSDN博客 ?? 你的点赞就是小编不断更新的最大动力 ??那么废话不多说直接开整吧~~ 目录 ???1.适配器模式? ??1.1适配器模式定义 ?编辑 ??1.2适配器模式角…...
STM32基础篇(三)------滴答定时器
滴答定时器简介 SysTick定时器(STK) 处理器有一个24位系统定时器SysTick,它从重新加载值倒计时到零,在下一个时钟沿重新加载(换行)LOAD寄存器中的值,然后对后续时钟倒计时。当处理器暂停调试时&…...
如何连接 AWS 上的服务器
连接到 AWS 上的服务器(通常是 EC2 实例)需要使用 SSH 并提供正确的私钥文件。以下是详细的步骤: 1. 下载并准备 .pem 文件 AWS 提供的私钥文件通常是 .pem 文件。确保你已下载该 .pem 文件,并将它存放在本地计算机上。 注意&a…...
Sublime Text4安装、汉化
-------------2025-02-22可用---------------------- 官方网址下载:https://www.sublimetext.com 打开https://hexed.it 点击打开文件找到软件安装目录下的 ctrlf 查找 8079 0500 0f94 c2右边启用替换替换为:c641 0501 b200 90点击替换按钮 替换完成后 另存为本地…...
CameraX学习1-关于预览、拍照、对焦
关于CameraX是否可以打开多种特殊摄像头,例如广角、长焦、景深等等 虽然CameraSelector只简单定义了前置后置,没具体指明摄像头,但是可以跟Camera2 API的CameraCharacteristics结合使用,获取对应的cameraid,再传入Came…...
【愚公系列】《Python网络爬虫从入门到精通》033-DataFrame的数据排序
标题详情作者简介愚公搬代码头衔华为云特约编辑,华为云云享专家,华为开发者专家,华为产品云测专家,CSDN博客专家,CSDN商业化专家,阿里云专家博主,阿里云签约作者,腾讯云优秀博主,腾讯云内容共创官,掘金优秀博主,亚马逊技领云博主,51CTO博客专家等。近期荣誉2022年度…...
RBF神经网络+NSGAII多目标优化算法,工艺参数优化、工程设计优化(Matlab)
目录 效果一览基本介绍程序设计参考资料 效果一览 基本介绍 1.RBF神经网络NSGAII多目标优化算法(Matlab完整源码和数据) 多目标优化是指在优化问题中同时考虑多个目标的优化过程。在多目标优化中,通常存在多个冲突的目标,即改善一…...
LVS+Keepalived高可用群集配置案例
以下是一个 LVSKeepalived 高可用群集配置案例: 1、环境准备 LVS 主调度器(lvs1):IP 地址为 192.168.8.101,心跳 IP 为 192.168.4.101LVS 备调度器(lvs2):IP 地址为 192.168.8.102…...
执行yum -y install npt 报错解决
Cannot find a valid baseurl for repo: base/7/x86_64 解决办法 一、检查网络连接 确保你的服务器可以访问互联网。你可以使用 ping 命令来测试: ping www.baidu.com 若能访问外网,则网络没问题,否则检查网络 二、修改CentOS-Base.rep…...
常见AI写作工具介绍(ChatGPT 4o、DeepClaude、Claude 3.5 Sonnet 、DeepSeek R1等)
AI写作工具介绍 1. ChatGPT-4o ChatGPT-4o是OpenAI于2024年5月发布的最新旗舰模型,相比之前的版本,它在多模态支持和实时推理能力上有了显著提升。它能够处理和理解音频、图像和文本数据,适用于复杂的图像分析、语音识别等应用场景[1]。 2…...
Android Studio 新版本Gradle通过JitPack发布Maven仓库示例
发布本地仓库示例:https://blog.csdn.net/loutengyuan/article/details/145938967 以下是基于 Android Studio 24.2.2(Gradle 8.10.2 AGP 8.8.0 JDK17) 的通过JitPack发布Maven仓库示例,包含aar和jar的不同配置: 1.…...
【官方配图】win10/win11 安装cuda 和 cudnn
文章目录 参考资料1.安装cuda toolkit1. 下载安装包2.安装验证 2. 安装cudnn下载cudnn安装包安装cudnn安装后的配置 参考资料 官方nvidia安装cuda官方nvidia安装cudnn 1.安装cuda toolkit 1. 下载安装包 下载地址 https://developer.nvidia.com/cuda-downloads?target_osW…...
使用 kubeadm 创建高可用 Kubernetes 及外部 etcd 集群
博客地址:使用 kubeadm 创建高可用 Kubernetes 及外部 etcd 集群 前言 Kubernetes 的官方中文文档内容全面,表达清晰,有大量示例和解析 无论任何情况下都推荐先花几个小时通读官方文档,来了解配置过程中的可选项,以…...
