Kubernetes环境搭建

news2024/10/3 4:32:05

华子目录

  • `Kubernetes`部署说明
  • 环境准备工作
    • 主机准备
    • `harbor`搭建
    • `k8s`集群中的`主机名`和`ip`设定
    • `k8s`集群中设置`hosts解析`
    • `k8s`中的所有节点关闭`防火墙`和`selinux`
    • `k8s`集群中`禁用swap分区`
    • `k8s`集群中安装`docker-ce`
    • `k8s`集群中`下载harbor证书`
    • `k8s`集群中配置`harbor镜像加速器`
  • `k8s`节点登录`harbor`测试

Kubernetes部署说明

K8S中文官网:https://kubernetes.io/zh-cn

主机名ip角色
harbor.huazi.org172.25.254.250harbor仓库
k8s-master.org172.25.254.100masterk8s集群控制节点
k8s-node1.org172.25.254.10workerk8s集群工作节点
k8s-node2.org172.25.254.20workerk8s集群工作节点

要求:除了harbor服务器的所有k8s节点

  • 所有节点禁用selinux防火墙
  • 所有节点同步时间解析
  • 所有节点安装docker-ce
  • 所有节点禁用swap,注意注释掉/etc/fstab文件中的定义(因为k8s集群中容器对内存要求非常高,如果不禁用swap,一些容器就会存到swap中,这样可能会使你的容器暂停或者运行缓慢

环境准备工作

主机准备

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

harbor搭建

  • harbor的搭建,我们可以参考这篇博客:
  • https://blog.csdn.net/huaz_md/article/details/142671140?spm=1001.2014.3001.5501

这里博主只写出几个关键操作

  • 制作https证书key
[root@harbor ~]# openssl req -newkey rsa:4096 -nodes -sha256 -keyout certs/huazi.org.key -addext "subjectAltName = DNS:harbor.huazi.org" -x509 -days 365 -out certs/huazi.org.crt
-----
Country Name (2 letter code) [XX]:CN
State or Province Name (full name) []:shanxi
Locality Name (eg, city) [Default City]:xi'an
Organization Name (eg, company) [Default Company Ltd]:docker
Organizational Unit Name (eg, section) []:registry
Common Name (eg, your name or your server's hostname) []:harbor.huazi.org
Email Address []:admin@huazi.org
  • 修改harbor的配置文件
[root@harbor harbor]# cp harbor.yml.tmpl harbor.yml
[root@harbor harbor]# vim harbor.yml

在这里插入图片描述

  • 启动harbor
[root@harbor harbor]# ./install.sh --with-chartmuseum

关闭防火墙和selinux

[root@harbor ~]# systemctl is-active firewalld.service
inactive
[root@harbor ~]# getenforce
Disabled

k8s集群中的主机名ip设定

  • k8s-master
[root@k8s-master ~]# hostname -I
172.25.254.100
[root@k8s-master ~]# hostnamectl hostname k8s-master.org
[root@k8s-master ~]# hostname
k8s-master.org
  • k8s-node1
[root@k8s-node1 ~]# hostname -I
172.25.254.10
[root@k8s-node1 ~]# hostnamectl hostname k8s-node1.org
[root@k8s-node1 ~]# hostname
k8s-node1.org
  • k8s-node2
[root@k8s-node2 ~]# hostname -I
172.25.254.20
[root@k8s-node2 ~]# hostnamectl hostname k8s-node2.org
[root@k8s-node2 ~]# hostname
k8s-node2.org

k8s集群中设置hosts解析

  • k8s-master
[root@k8s-master ~]# vim /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
172.25.254.100   k8s-master.org
172.25.254.10    k8s-node1.org
172.25.254.20    k8s-node2.org
172.25.254.250   harbor.huazi.org
  • k8s-node1(这里我们使用scp命令
[root@k8s-master ~]# scp   /etc/hosts   root@172.25.254.10:/etc/hosts
The authenticity of host '172.25.254.10 (172.25.254.10)' can't be established.
ED25519 key fingerprint is SHA256:oRI0QHrpuaAH8E6hepK2f2FymklDq9LifjGxkU86pMg.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '172.25.254.10' (ED25519) to the list of known hosts.
root@172.25.254.10's password:
hosts                                                         100%  286   253.6KB/s   00:00


[root@k8s-node1 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
172.25.254.100   k8s-master.org
172.25.254.10    k8s-node1.org
172.25.254.20    k8s-node2.org
172.25.254.250   harbor.huazi.org
  • k8s-node2(这里我们使用scp命令
[root@k8s-master ~]# scp   /etc/hosts   root@172.25.254.20:/etc/hosts
The authenticity of host '172.25.254.20 (172.25.254.20)' can't be established.
ED25519 key fingerprint is SHA256:oRI0QHrpuaAH8E6hepK2f2FymklDq9LifjGxkU86pMg.
This host key is known by the following other names/addresses:
    ~/.ssh/known_hosts:1: 172.25.254.10
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '172.25.254.20' (ED25519) to the list of known hosts.
root@172.25.254.20's password:
hosts                                                         100%  286   431.8KB/s   00:00



[root@k8s-node2 ~]# cat /etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6
172.25.254.100   k8s-master.org
172.25.254.10    k8s-node1.org
172.25.254.20    k8s-node2.org
172.25.254.250   harbor.huazi.org
  • ping测试
[root@k8s-master ~]# ping harbor.huazi.org
PING harbor.huazi.org (172.25.254.250) 56(84) 比特的数据。
64 比特,来自 harbor.huazi.org (172.25.254.250): icmp_seq=1 ttl=64 时间=0.629 毫秒
64 比特,来自 harbor.huazi.org (172.25.254.250): icmp_seq=2 ttl=64 时间=0.288 毫秒
^C
--- harbor.huazi.org ping 统计 ---
已发送 2 个包, 已接收 2 个包, 0% packet loss, time 1061ms
rtt min/avg/max/mdev = 0.288/0.458/0.629/0.170 ms
[root@k8s-master ~]# ping k8s-node1.org
PING k8s-node1.org (172.25.254.10) 56(84) 比特的数据。
64 比特,来自 k8s-node1.org (172.25.254.10): icmp_seq=1 ttl=64 时间=0.422 毫秒
64 比特,来自 k8s-node1.org (172.25.254.10): icmp_seq=2 ttl=64 时间=0.339 毫秒
^C
--- k8s-node1.org ping 统计 ---
已发送 2 个包, 已接收 2 个包, 0% packet loss, time 1038ms
rtt min/avg/max/mdev = 0.339/0.380/0.422/0.041 ms
[root@k8s-master ~]# ping k8s-node2.org
PING k8s-node2.org (172.25.254.20) 56(84) 比特的数据。
64 比特,来自 k8s-node2.org (172.25.254.20): icmp_seq=1 ttl=64 时间=0.660 毫秒
64 比特,来自 k8s-node2.org (172.25.254.20): icmp_seq=2 ttl=64 时间=0.256 毫秒
64 比特,来自 k8s-node2.org (172.25.254.20): icmp_seq=3 ttl=64 时间=0.666 毫秒
^C
--- k8s-node2.org ping 统计 ---
已发送 3 个包, 已接收 3 个包, 0% packet loss, time 2078ms
rtt min/avg/max/mdev = 0.256/0.527/0.666/0.191 ms

k8s中的所有节点关闭防火墙selinux

  • k8s-master
[root@k8s-master ~]# systemctl is-active firewalld.service
inactive
[root@k8s-master ~]# getenforce
Disabled
  • k8s-node1
[root@k8s-node1 ~]# systemctl is-active firewalld.service
inactive
[root@k8s-node1 ~]# getenforce
Disabled
  • k8s-node2
[root@k8s-node2 ~]# systemctl is-active firewalld.service
inactive
[root@k8s-node2 ~]# getenforce
Disabled

k8s集群中禁用swap分区

  • k8s-master
[root@k8s-master ~]# vim /etc/fstab

在这里插入图片描述

[root@k8s-master ~]# swapon -s
Filename                                Type            Size            Used            Priority
/dev/nvme0n1p2                          partition       2097148         0               -2
[root@k8s-master ~]# swapoff -a
[root@k8s-master ~]# swapon -s  #发现swap分区已经没了
[root@k8s-master ~]#
  • k8s-node1
[root@k8s-node1 ~]# vim /etc/fstab

在这里插入图片描述

[root@k8s-node1 ~]# systemctl mask swap.target
Created symlink /etc/systemd/system/swap.target → /dev/null.
[root@k8s-node1 ~]# swapoff -a
[root@k8s-node1 ~]# swapon -s
  • k8s-node2
[root@k8s-node2 ~]# vim /etc/fstab

在这里插入图片描述

[root@k8s-node2 ~]# systemctl mask swap.target
Created symlink /etc/systemd/system/swap.target → /dev/null.
[root@k8s-node2 ~]# swapoff -a
[root@k8s-node2 ~]# swapon -s

k8s集群中安装docker-ce

[root@k8s-master yum.repos.d]# vim redhat.repo
[docker]
name=docker-ce
baseurl=https://mirrors.aliyun.com/docker-ce/linux/rhel/9/x86_64/stable/
gpgcheck=0


[root@k8s-master yum.repos.d]# scp /etc/yum.repos.d/redhat.repo root@172.25.254.10:/etc/yum.repos.d/
root@172.25.254.10's password:
redhat.repo                                                   100%  108   130.7KB/s   00:00



[root@k8s-master yum.repos.d]# scp /etc/yum.repos.d/redhat.repo root@172.25.254.20:/etc/yum.repos.d/
root@172.25.254.20's password:
redhat.repo                                                   100%  108   180.7KB/s   00:00
  • k8s-master
[root@k8s-master ~]# yum install docker-ce -y


[root@k8s-master ~]# systemctl enable --now docker
  • k8s-node1
[root@k8s-node1 ~]# yum install docker-ce -y


[root@k8s-node1 ~]# systemctl enable --now docker
  • k8s-node2
[root@k8s-node2 ~]# yum install docker-ce -y


[root@k8s-node2 ~]# systemctl enable --now docker

当我们在执行docker info后,出现了如下WARNING,如何处理呢

[root@k8s-master ~]# docker info
......
......
......
WARNING: bridge-nf-call-iptables is disabled
WARNING: bridge-nf-call-ip6tables is disabled
[root@k8s-master ~]# echo br_netfilter > /etc/modules-load.d/docker_mod.conf

[root@k8s-master ~]# modprobe br_netfilter

[root@k8s-master ~]# vim /etc/sysctl.d/docker.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1


[root@k8s-master ~]# sysctl --system

[root@k8s-master ~]# systemctl restart docker
[root@k8s-node1 ~]# echo br_netfilter > /etc/modules-load.d/docker_mod.conf

[root@k8s-node1 ~]# modprobe br_netfilter

[root@k8s-node1 ~]# vim /etc/sysctl.d/docker.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1


[root@k8s-node1 ~]# sysctl --system

[root@k8s-node1 ~]# systemctl restart docker
[root@k8s-node2 ~]# echo br_netfilter > /etc/modules-load.d/docker_mod.conf

[root@k8s-node2 ~]# modprobe br_netfilter

[root@k8s-node2 ~]# vim /etc/sysctl.d/docker.conf
net.bridge.bridge-nf-call-iptables = 1
net.bridge.bridge-nf-call-ip6tables = 1
net.ipv4.ip_forward = 1


[root@k8s-node2 ~]# sysctl --system

[root@k8s-node2 ~]# systemctl restart docker

再次docker info时,就没有WARNING

k8s集群中下载harbor证书

  • k8s-master
[root@k8s-master ~]# mkdir -p /etc/docker/certs.d/harbor.huazi.org/


[root@k8s-master ~]# scp    root@harbor.huazi.org:/root/certs/huazi.org.crt   /etc/docker/certs.d/harbor.huazi.org/ca.crt
The authenticity of host 'harbor.huazi.org (172.25.254.250)' can't be established.
ED25519 key fingerprint is SHA256:wkrDVNwOtwB4XhstKSlH+BEeO8JE3gp9NDIKRe6aMu0.
This host key is known by the following other names/addresses:
    ~/.ssh/known_hosts:5: 172.25.254.250
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added 'harbor.huazi.org' (ED25519) to the list of known hosts.
root@harbor.huazi.org's password:
huazi.org.crt                                                          100% 2175     1.9MB/s   00:00


[root@k8s-master ~]# ll /etc/docker/certs.d/harbor.huazi.org/ca.crt
-rw-r--r-- 1 root root 2163 102 05:19 /etc/docker/certs.d/harbor.huazi.org/ca.crt


[root@k8s-master ~]# systemctl restart docker
  • k8s-node1
[root@k8s-node1 ~]# mkdir -p /etc/docker/certs.d/harbor.huazi.org/


[root@k8s-node1 ~]# scp    root@harbor.huazi.org:/root/certs/huazi.org.crt   /etc/docker/certs.d/harbor.huazi.org/ca.crt
root@harbor.huazi.org's password:
huazi.org.crt                                                          100% 2175     2.4MB/s   00:00


[root@k8s-node1 ~]# ll /etc/docker/certs.d/harbor.huazi.org/ca.crt
-rw-r--r-- 1 root root 2175 102 05:55 /etc/docker/certs.d/harbor.huazi.org/ca.crt


[root@k8s-node1 ~]# systemctl restart docker
  • k8s-node2
[root@k8s-node2 ~]# mkdir -p /etc/docker/certs.d/harbor.huazi.org/


[root@k8s-node2 ~]# scp    root@harbor.huazi.org:/root/certs/huazi.org.crt   /etc/docker/certs.d/harbor.huazi.org/ca.crt
root@harbor.huazi.org's password:
huazi.org.crt                                                          100% 2175     2.5MB/s   00:00


[root@k8s-node2 ~]# ll /etc/docker/certs.d/harbor.huazi.org/ca.crt
-rw-r--r-- 1 root root 2175 102 05:57 /etc/docker/certs.d/harbor.huazi.org/ca.crt


[root@k8s-node2 ~]# systemctl restart docker

k8s集群中配置harbor镜像加速器

  • k8s-master
[root@k8s-master ~]# cd /etc/docker/
[root@k8s-master docker]# ls
certs.d
[root@k8s-master docker]# vim daemon.json
{
        "registry-mirrors": ["https://harbor.huazi.org"]
}
[root@k8s-master docker]# systemctl restart docker


[root@k8s-master ~]# docker info
......
......
......
 Registry Mirrors:
  https://harbor.huazi.org/
  • k8s-node1
[root@k8s-node1 ~]# cd /etc/docker/
[root@k8s-node1 docker]# ls
certs.d
[root@k8s-node1 docker]# vim daemon.json
{
        "registry-mirrors": ["https://harbor.huazi.org"]
}
[root@k8s-node1 docker]# cd
[root@k8s-node1 ~]# systemctl restart docker



[root@k8s-node1 ~]# docker info
......
......
......
 Registry Mirrors:
  https://harbor.huazi.org/
  • k8s-node2
[root@k8s-node2 ~]# cd /etc/docker/
[root@k8s-node2 docker]# ls
certs.d
[root@k8s-node2 docker]# vim daemon.json
{
        "registry-mirrors": ["https://harbor.huazi.org"]
}
[root@k8s-node2 docker]# cd
[root@k8s-node2 ~]# systemctl restart docker


[root@k8s-node2 ~]# docker info
......
......
......
 Registry Mirrors:
  https://harbor.huazi.org/

k8s节点登录harbor测试

  • k8s-master
[root@k8s-master ~]# docker login harbor.huazi.org
Username: admin
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credential-stores

Login Succeeded
  • k8s-node1
[root@k8s-node1 ~]# docker login harbor.huazi.org
Username: admin
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credential-stores

Login Succeeded
  • k8s-node2
[root@k8s-node2 ~]# docker login harbor.huazi.org
Username: admin
Password:
WARNING! Your password will be stored unencrypted in /root/.docker/config.json.
Configure a credential helper to remove this warning. See
https://docs.docker.com/engine/reference/commandline/login/#credential-stores

Login Succeeded

至此kubernetes环境搭建成功

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.coloradmin.cn/o/2185532.html

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈,一经查实,立即删除!

相关文章

当人工智能拥抱餐饮业,传统与创新的交融

大家好,我是Shelly,一个专注于输出AI工具和科技前沿内容的AI应用教练,体验过300款以上的AI应用工具。关注科技及大模型领域对社会的影响10年。关注我一起驾驭AI工具,拥抱AI时代的到来。 今天我们要聊一个充满烟火气的行业&#x…

C++进阶知识 AVL树实现

AVL树 1. AVL的概念2. AVL树的实现2.1 AVL树的结构2.2 AVL树的插⼊2.2.1 AVL树插⼊⼀个值的⼤概过程2.2.2 平衡因⼦更新 2.3 旋转2.3.1 旋转的原则2.3.2 右单旋2.3.4 左单旋2.3.5 左右双旋 3.代码实现 1. AVL的概念 • AVL树是最先发明的⾃平衡⼆叉查找树,AVL是⼀颗…

Linux Debian12使用Podman安装bwapp靶场环境

一、bwapp简介 bWAPP(buggy Web Application)是一个开源的、故意设计有漏洞的Web应用程序,旨在帮助安全爱好者、开发人员和学生发现和防止Web漏洞。它包含了超过100种不同的漏洞,涵盖了所有主要的已知Web漏洞。 二、bwapp下载 …

C++系列-多态

🌈个人主页:羽晨同学 💫个人格言:“成为自己未来的主人~” 多态 多态就是不同类型的对象,去做同一个行为,但是产生的结果是不同的。 比如说: 都是动物叫声,猫是喵喵,狗是汪汪&am…

安装图片标识工具anylabeling

目录 下载压缩包 创建环境 安装opencv 安装第三方库 运行setup.py文件 安装过程可能会出现的错误: 错误1 错误2 安装完成 图标更换 之前提到的嵌入式开发】可编程4k蓝牙摄像头点击器还可以训练模型,使图像识别精度提高 现在讲解,如…

wsl(4) -- 编译驱动模块

1. 内核源码 编译模块需要内核源码信息,wsl是修改过的内核无法使用下面的命令从标准镜像源上下载内核源码信息。 sudo apt-get install kernel-headers-$(uname -r) sudo apt-get install kernel-devel-$(uname -r)2. 下载wsl内核源码 可以考虑下载wsl的源码重新…

【分页】Spring Boot 列表分页 + javaScript前台展示

后端: 准备好查询实体与分页实体 1、分页工具实体 package com.ruoyi.dms.config;import com.alibaba.nacos.api.model.v2.Result; import lombok.Data;import java.io.Serializable; import java.util.List;/*** author 宁兴星* description: 列表返回结果集*/ …

信息学奥赛复赛复习09-CSP-J2020-03表达式求值前置知识点-中缀表达式求值、模运算、模运算性质、栈

PDF文档回复:20241002 **1 P1981 [NOIP2013普及组] 表达式求值 ** [题目描述] 给定一个只包含加法和乘法的算术表达式,请你编程计算表达式的值 [输入格式] 一行,为需要你计算的表达式,表达式中只包含数字、加法运算符 “” 和乘法运算符 …

C/C++语言基础--C++IO流、输入输出流、文件流、字符串流、重定向流等详解

本专栏目的 更新C/C的基础语法,包括C的一些新特性 前言 流思想,我认为在计算机中是一个很重要的思想,因为计算机、编程无非就是获取数据,然后对数据进行操作;C给主要给我们提供了3种流,输入输出流、文件流…

react-问卷星项目(4)

项目实战 使用CSS 尽量不要使用内联CSS 内联style代码多&#xff0c;性能差&#xff0c;扩展性差外链css文件可复用代码&#xff0c;可单独缓存文件 元素内联style 和HTMl元素的style相似必须用JS写法&#xff0c;不能是字符串&#xff0c;里面必须是对象 <span style…

# VirtualBox中安装的CentOS 6.5网络设置为NAT模式时,怎么使用SecureCRT连接CentOS6.5系统?

VirtualBox中安装的CentOS 6.5网络设置为NAT模式时&#xff0c;怎么使用SecureCRT连接CentOS6.5系统&#xff1f; 一、查询 【VirtualBox Host-Only Network】虚拟网卡的网络配置 IP。 1、按键盘上WIN R 组合键&#xff0c;打开【运行】&#xff0c;输入【 ncpa.cpl 】&…

C0012.Clion改用VS编译器开发Qt界面

1.VS编译器添加 2.配置MSVC2019环境变量 3.各种问题报错与解决 问题描述 warning C4819&#xff1a;该文件包含不能在当前代码页(936)中表示的字符。解决办法 在CMakeLists.txt中添加如下代码 # 如下代码只在使用VS编译器时需要&#xff0c;使用mingw32编译器时需要注释掉 #…

利用Numpy实现全连接神经网络实验分析

一、实验要求 用 python 的 numpy 模块实现全连接神经网络。网络结构为一个输入层、一个隐藏层、一个输出层。隐藏层的激活函数为 Relu 函数&#xff0c;输出层的激活函数为 softmax 函数&#xff0c;损失函数为交叉熵。 二、实验目的 学会构建一个简单的全连接神经网络模型学…

鸿蒙网络管理模块01——HTTP与WebSocket请求数据

如果你也对鸿蒙开发感兴趣&#xff0c;加入“Harmony自习室”吧&#xff01;扫描下方名片&#xff0c;关注公众号&#xff0c;公众号更新更快&#xff0c;同时也有更多学习资料和技术讨论群。 1、概述 鸿蒙的网络管理模块主要提供以下功能&#xff1a; HTTP数据请求&#xff1…

影刀RPA实战:网页爬虫之电影数据

1.实战目标 电影自媒体是指个人或团队通过互联网平台&#xff0c;如微博、微信公众号、抖音、B站等&#xff0c;发布与电影相关的内容&#xff0c;包括但不限于电影评论、推荐、幕后制作揭秘、明星访谈等。这些内容旨在吸引电影爱好者&#xff0c;并与之互动&#xff0c;构建起…

十六字心传

中国文化传统中著名的“十六字心传”&#xff1a;“人心惟危&#xff0c;道心惟微&#xff1b;惟精惟一&#xff0c;允执厥中。 ”语出于《虞书大禹谟》。 人心与道心&#xff1a;人的人欲与天理的区别&#xff1b;所谓“人心惟危”&#xff0c;即是说人们的那种物欲情欲&…

【FPGA开发】Xilinx FPGA差分输入时钟的使用方法

正文 以前在使用ZYNQ的领航者ZYNQ7020进行FPGA学习时&#xff0c;它们使用的单端50M的输入时钟&#xff0c;在verlog代码编写上比较简单&#xff0c;而现在使用Alinx的AXU3EG开发板时&#xff0c;发现它使用的是200M的差分输入时钟&#xff0c;哪这个时候&#xff0c;输入时钟要…

pyecharts-快速入门

pyecharts文档&#xff1a;渲染图表 - pyecharts - A Python Echarts Plotting Library built with love. pyecharts-gallery文档&#xff1a;中文简介 - Document (pyecharts.org) 一、快速入门案例 from pyecharts.charts import Barbar Bar() bar.add_xaxis(["衬衫…

7-3 集合的运算-并、交、对称差

顺序表&#xff1a; #include <bits/stdc.h> using namespace std; int main() {int n;cin>>n;int *pnew int[n];for(int i0;i<n;i)cin>>p[i];int m;cin>>m;int *qnew int [m];for(int j0;j<m;j)cin>>q[j];int *bingnew int[nm];int *jia…

详细介绍:API 和 SPI 的区别

文章目录 Java SPI (Service Provider Interface) 和 API (Application Programming Interface) 的区别详解目录1. 定义和目的1.1 API (Application Programming Interface)1.2 SPI (Service Provider Interface) 2. 使用场景2.1 API 的应用场景2.2 SPI 的应用场景 3. 加载和调…