当前位置: 首页 > news >正文

在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 集群&#xff0c;包括容器运行时 containerd 的安装与配置&#xff0c;以及使用 kubeadm 进行集群初始…...

基于Python socket库构建的基于 P2P 的文件共享系统示例

基于 P2P 的文件共享系统 实现方式&#xff1a; 使用 Python 的socket库构建 P2P 网络&#xff0c;节点之间通过 TCP 或 UDP 协议进行通信。每个节点维护一个文件列表&#xff0c;并向其他节点广播自己拥有的文件信息。当一个节点需要某个文件时&#xff0c;它会向网络中的其…...

JavaScript 函数重载:灵活应对多场景的编程技巧

在 JavaScript 中&#xff0c;函数重载&#xff08;Function Overloading&#xff09;是一个常见的需求。尽管 JavaScript 本身并不支持传统意义上的函数重载&#xff08;即在同一个作用域内定义多个同名函数&#xff0c;根据参数的不同调用不同的函数&#xff09;&#xff0c;…...

通过 PromptTemplate 生成干净的 SQL 查询语句并执行SQL查询语句

问题描述 在使用 LangChain 和 Llama 模型生成 SQL 查询时&#xff0c;遇到了 sqlite3.OperationalError 错误。错误信息如下&#xff1a; OperationalError: (sqlite3.OperationalError) near "sql SELECT Name FROM MediaType LIMIT 5; ": syntax error [SQL: …...

用大白话解释缓存Redis +MongoDB是什么有什么用怎么用

Redis和MongoDB是什么&#xff1f; Redis&#xff1a;像你家的“小冰箱”&#xff0c;专门存高频使用的食物&#xff08;数据&#xff09;。它是基于内存的键值数据库&#xff0c;读写速度极快&#xff08;每秒超10万次操作&#xff09;。比如你每次打开手机App&#xff0c;用…...

计算机毕业设计SpringBoot+Vue.js汽车销售网站(源码+文档+PPT+讲解)

温馨提示&#xff1a;文末有 CSDN 平台官方提供的学长联系方式的名片&#xff01; 温馨提示&#xff1a;文末有 CSDN 平台官方提供的学长联系方式的名片&#xff01; 温馨提示&#xff1a;文末有 CSDN 平台官方提供的学长联系方式的名片&#xff01; 作者简介&#xff1a;Java领…...

【0010】HTML水平线标签详解

如果你觉得我的文章写的不错&#xff0c;请关注我哟&#xff0c;请点赞、评论&#xff0c;收藏此文章&#xff0c;谢谢&#xff01; 本文内容体系结构如下&#xff1a; 一、水平线标签概述 在HTML中&#xff0c;<hr>标签用于在网页上插入一条水平线&#xff0c;其主要…...

FastExcel与Reactor响应式编程深度集成技术解析

一、技术融合背景与核心价值 在2025年企业级应用开发中&#xff0c;大规模异步Excel处理与响应式系统架构的结合已成为技术刚需。FastExcel与Reactor的整合方案&#xff0c;通过以下技术协同实现突破性性能&#xff1a; 内存效率革命&#xff1a;FastExcel的流式字节操作与Re…...

Netty是如何实现零拷贝的?

大家好&#xff0c;我是锋哥。今天分享关于【Netty是如何实现零拷贝的&#xff1f;】面试题。希望对大家有帮助&#xff1b; Netty是如何实现零拷贝的&#xff1f; 1000道 互联网大厂Java工程师 精选面试题-Java资源分享网 Netty是一个高性能的Java网络应用框架&#xff0c;它…...

【大模型➕知识图谱】大模型结合医疗知识图谱:解锁智能辅助诊疗系统新范式

【大模型➕知识图谱】大模型结合医疗知识图谱:解锁智能辅助诊疗系统新范式 大模型结合医疗知识图谱:解锁智能辅助诊疗系统新范式引言一、系统架构1.1 系统架构图1.2 架构模块说明1.2.1 用户输入1.2.2 大模型(语义理解与意图识别)1.2.3 Agent(问题解析与任务分配)1.2.4 问…...

Spring Boot @Component注解介绍

Component 是 Spring 中的一个核心注解&#xff0c;用于声明一个类为 Spring 管理的组件&#xff08;Bean&#xff09;。它是一个通用的注解&#xff0c;可以用于任何层次的类&#xff08;如服务层、控制器层、持久层等&#xff09;。通过 Component 注解&#xff0c;Spring 会…...

MulFS-CAP: Multimodal Fusion-supervisedCross-modal

一种用于无注册红外-可见图像融合的单阶段框架。与传统的两阶段方法不同&#xff0c;MulFS-CAP结合了隐式注册和融合&#xff0c;简化了处理流程并增强了实用性。该方法使用共享的浅层特征编码器&#xff0c;同时进行特征对齐和图像融合。通过引入可学习的模态字典&#xff0c;…...

WordPress多语言插件GTranslate

GTranslate是一个免费的WordPress多语言插件&#xff0c;它允许您将网站内容翻译成多种语言。这个插件提供了一个简单易用的界面&#xff0c;让您可以在WordPress后台直接进行翻译操作。以下是GTranslate插件的一些主要特点&#xff1a; 免费使用&#xff1a;GTranslate插件完…...

wordpress子分类调用父分类名称和链接的3种方法

专为导航而生&#xff0c;在wordpress模板制作过程中常常会在做breadcrumbs导航时会用到&#xff0c;子分类调用父分类的名称和链接&#xff0c;下面这段简洁的代码&#xff0c;可以完美解决这个问题。 <?php echo get_category_parents( $cat, true, &raquo; ); ?…...

Prometheus + Grafana 监控

Prometheus Grafana 监控 官网介绍&#xff1a;Prometheus 是一个开源系统 监控和警报工具包最初由 SoundCloud 构建。自 2012 年成立以来&#xff0c;许多 公司和组织已经采用了 Prometheus&#xff0c;并且该项目具有非常 活跃的开发人员和用户社区。它现在是一个独立的开源…...

初学STM32之简单认识IO口配置(学习笔记)

在使用51单片机的时候基本上不需要额外的配置IO&#xff0c;不过在使用特定的IO的时候需要额外的设计外围电路&#xff0c;比如PO口它是没有内置上拉电阻的。因此若想P0输出高电平&#xff0c;它就需要外接上拉电平。&#xff08;当然这不是说它输入不需要上拉电阻&#xff0c;…...

springboot2.7.18升级springboot3.3.0遇到的坑

druid的警告&#xff0c;警告如下&#xff1a; 运行警告2025-02-28T09:20:31.28508:00 WARN 18800 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean com.alibaba.druid.spring.boot3.autoconfigure.stat.DruidSpringAopConfiguration of type [com.a…...

gtest 和 gmock讲解

Google Test&#xff08;gtest&#xff09;和 Google Mock&#xff08;gmock&#xff09;是 Google 开发的用于 C 的测试框架和模拟框架&#xff0c;以下是对它们的详细讲解&#xff1a; Google Test&#xff08;gtest&#xff09; 简介 Google Test 是一个用于 C 的单元测试框…...

GC垃圾回收介绍及GC算法详解

目录 引言 GC的作用域 什么是垃圾回收&#xff1f; 常见的GC算法 1.引用计数法 2.复制算法 3.标记清除 4.标记整理 小总结 5.分代收集算法 ps:可达性分析算法&#xff1f; 可达性分析的作用 可达性分析与垃圾回收算法的关系 结论 引言 在编程世界中&#xff0c;…...

2020 年英语(一)考研真题 笔记(更新中)

Section I Use of English&#xff08;完型填空&#xff09; 原题 Directions&#xff1a;Read the following text. Choose the best word (s) for each numbered blank and mark A, B, C or D on the ANSWER SHEET. (10 points) Even if families are less likely to si…...

观成科技:隐蔽隧道工具Ligolo-ng加密流量分析

1.工具介绍 Ligolo-ng是一款由go编写的高效隧道工具&#xff0c;该工具基于TUN接口实现其功能&#xff0c;利用反向TCP/TLS连接建立一条隐蔽的通信信道&#xff0c;支持使用Let’s Encrypt自动生成证书。Ligolo-ng的通信隐蔽性体现在其支持多种连接方式&#xff0c;适应复杂网…...

【git】把本地更改提交远程新分支feature_g

创建并切换新分支 git checkout -b feature_g 添加并提交更改 git add . git commit -m “实现图片上传功能” 推送到远程 git push -u origin feature_g...

MySQL账号权限管理指南:安全创建账户与精细授权技巧

在MySQL数据库管理中&#xff0c;合理创建用户账号并分配精确权限是保障数据安全的核心环节。直接使用root账号进行所有操作不仅危险且难以审计操作行为。今天我们来全面解析MySQL账号创建与权限分配的专业方法。 一、为何需要创建独立账号&#xff1f; 最小权限原则&#xf…...

安卓基础(aar)

重新设置java21的环境&#xff0c;临时设置 $env:JAVA_HOME "D:\Android Studio\jbr" 查看当前环境变量 JAVA_HOME 的值 echo $env:JAVA_HOME 构建ARR文件 ./gradlew :private-lib:assembleRelease 目录是这样的&#xff1a; MyApp/ ├── app/ …...

Python Ovito统计金刚石结构数量

大家好,我是小马老师。 本文介绍python ovito方法统计金刚石结构的方法。 Ovito Identify diamond structure命令可以识别和统计金刚石结构,但是无法直接输出结构的变化情况。 本文使用python调用ovito包的方法,可以持续统计各步的金刚石结构,具体代码如下: from ovito…...

DingDing机器人群消息推送

文章目录 1 新建机器人2 API文档说明3 代码编写 1 新建机器人 点击群设置 下滑到群管理的机器人&#xff0c;点击进入 添加机器人 选择自定义Webhook服务 点击添加 设置安全设置&#xff0c;详见说明文档 成功后&#xff0c;记录Webhook 2 API文档说明 点击设置说明 查看自…...

代码规范和架构【立芯理论一】(2025.06.08)

1、代码规范的目标 代码简洁精炼、美观&#xff0c;可持续性好高效率高复用&#xff0c;可移植性好高内聚&#xff0c;低耦合没有冗余规范性&#xff0c;代码有规可循&#xff0c;可以看出自己当时的思考过程特殊排版&#xff0c;特殊语法&#xff0c;特殊指令&#xff0c;必须…...

深入浅出WebGL:在浏览器中解锁3D世界的魔法钥匙

WebGL&#xff1a;在浏览器中解锁3D世界的魔法钥匙 引言&#xff1a;网页的边界正在消失 在数字化浪潮的推动下&#xff0c;网页早已不再是静态信息的展示窗口。如今&#xff0c;我们可以在浏览器中体验逼真的3D游戏、交互式数据可视化、虚拟实验室&#xff0c;甚至沉浸式的V…...

基于stm32F10x 系列微控制器的智能电子琴(附完整项目源码、详细接线及讲解视频)

注&#xff1a;文章末尾网盘链接中自取成品使用演示视频、项目源码、项目文档 所用硬件&#xff1a;STM32F103C8T6、无源蜂鸣器、44矩阵键盘、flash存储模块、OLED显示屏、RGB三色灯、面包板、杜邦线、usb转ttl串口 stm32f103c8t6 面包板 …...

Vue 实例的数据对象详解

Vue 实例的数据对象详解 在 Vue 中,数据对象是响应式系统的核心,也是组件状态的载体。理解数据对象的原理和使用方式是成为 Vue 专家的关键一步。我将从多个维度深入剖析 Vue 实例的数据对象。 一、数据对象的定义方式 1. Options API 中的定义 在 Options API 中,使用 …...