Kubeadm方式搭建K8s集群【1.26.0版本】

news2024/9/19 10:49:33

文章目录

    • 一、集群规划及架构
    • 二、系统初始化准备(所有节点同步操作)
    • 三、安装并配置Containerd容器运行时
    • 四、安装kubeadm(所有节点同步操作)
    • 五、初始化集群
    • 六、Node节点添加到集群
    • 七、安装网络组件Calico
    • 八、测试CoreDNS解析可用性
    • 九、拓展
      • 1、ctr和crictl命令具体区别

一、集群规划及架构

官方文档:

二进制下载地址

环境规划:

  • pod网段:10.244.0.0/16
  • service网段:10.10.0.0/16
  • 注意: pod和service网段不可冲突,如果冲突会导致K8S集群安装失败。
  • 容器运行时本次使用containerd。
主机名IP地址操作系统
master-116.32.15.200CentOS7.8
node-116.32.15.201CentOS7.8
node-216.32.15.202CentOS7.8

二、系统初始化准备(所有节点同步操作)

1、关闭防火墙

systemctl disable firewalld --now
setenforce 0
sed  -i -r 's/SELINUX=[ep].*/SELINUX=disabled/g' /etc/selinux/config

2、配置域名解析

cat  >> /etc/hosts << EOF
16.32.15.200 master-1
16.32.15.201 node-1
16.32.15.202 node-2
EOF

在指定主机上面修改主机名

hostnamectl set-hostname master-1 && bash
hostnamectl set-hostname node-1 && bash
hostnamectl set-hostname node-2 && bash

3、配置服务器时间保持一致

yum -y install ntpdate
ntpdate ntp1.aliyun.com

添加定时同步 每天凌晨1点自动同步时间

echo "0 1 * * * ntpdate ntp1.aliyun.com" >> /var/spool/cron/root
crontab -l

4、禁用swap交换分区(kubernetes强制要求禁用)

swapoff --all

禁止开机自启动swap交换分区

sed -i -r '/swap/ s/^/#/' /etc/fstab

5、修改Linux内核参数,添加网桥过滤器和地址转发功能

cat >> /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 -p /etc/sysctl.d/kubernetes.conf

加载网桥过滤器模块

modprobe br_netfilter
lsmod | grep br_netfilter # 验证是否生效

6、配置ipvs功能

在kubernetes中Service有两种代理模型,一种是基于iptables的,一种是基于ipvs,两者对比ipvs的性能要高,如果想要使用ipvs模型,需要手动载入ipvs模块

yum -y install ipset ipvsadm

cat > /etc/sysconfig/modules/ipvs.modules <<EOF
modprobe -- ip_vs
modprobe -- ip_vs_rr
modprobe -- ip_vs_wrr
modprobe -- ip_vs_sh
modprobe -- nf_conntrack_ipv4  
EOF

chmod +x /etc/sysconfig/modules/ipvs.modules 
# 执行脚本
/etc/sysconfig/modules/ipvs.modules

# 验证ipvs模块
lsmod | grep -e ip_vs -e nf_conntrack_ipv4

7、安装Docker容器组件

注意:Docker用来下载镜像、Dockerfile构建镜像等操作,和Containerd不冲突。

curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
yum makecache

# yum-utils软件用于提供yum-config-manager程序
yum install -y yum-utils

# 使用yum-config-manager创建docker阿里存储库
yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo

yum install docker-ce-20.10.6 docker-ce-cli-20.10.6 -y

Docker配置加速源:

mkdir /etc/docker
cat <<EOF > /etc/docker/daemon.json
{
  "registry-mirrors": ["https://aoewjvel.mirror.aliyuncs.com"]
}
EOF

# 启动docker并设置开机自启
systemctl enable docker --now
systemctl status docker

8、重启服务器 可略过

reboot

三、安装并配置Containerd容器运行时

三台服务器同时操作

1、安装containerd

yum -y install containerd.io-1.6.6

2、生成containerd配置文件,并修改配置文件

mkdir -p /etc/containerd
containerd config default > /etc/containerd/config.toml

修改配置文件,主要修改以下配置:

vim /etc/containerd/config.toml

SystemdCgroup = true
sandbox_image = "registry.aliyuncs.com/google_containers/pause:3.7"

3、启动containerd

systemctl enable containerd  --now

4、添加 crictl 工具的配置文件

crictl 是一个命令行工具,用于与 CRI(Container Runtime Interface)兼容的容器运行时进行交互。在 Kubernetes 中,Kubelet 使用 CRI 接口与容器运行时进行通信,而 crictl 工具则可以用于直接与容器运行时进行交互。

cat > /etc/crictl.yaml <<EOF
runtime-endpoint: unix:///run/containerd/containerd.sock
image-endpoint: unix:///run/containerd/containerd.sock
timeout: 10
debug: false
EOF
  • runtime-endpoint:指定容器运行时的地址
  • image-endpoint:指定镜像仓库的地址,即containerd所使用的镜像仓库的地址。

5、配置containerd镜像加速器

指定加速器目录信息:

vim /etc/containerd/config.toml

config_path = "/etc/containerd/certs.d"

配置加速信息:

mkdir /etc/containerd/certs.d/docker.io/ -p
vim /etc/containerd/certs.d/docker.io/hosts.toml

[host."https://vh3bm52y.mirror.aliyuncs.com",host."https://registry.docker-cn.com"]
  capabilities = ["pull"]

重启containerd

systemctl restart containerd

四、安装kubeadm(所有节点同步操作)

1、配置国内yum源,一键安装 kubeadm、kubelet、kubectl

cat <<EOF > /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64/
enabled=1
gpgcheck=0
EOF

yum install -y kubelet-1.26.0 kubeadm-1.26.0 kubectl-1.26.0

2、kubeadm将使用kubelet服务以容器方式部署kubernetes的主要服务,所以需要先启动kubelet服务

systemctl enable kubelet.service --now

五、初始化集群

在master-1主机上进行操作

1、配置容器运行时

crictl config runtime-endpoint unix:///run/containerd/containerd.sock

2、生成初始化默认配置文件

kubeadm config print init-defaults > kubeadm.yaml

我们根据自己需求进行修改默认配置文件,我主要更改了一下配置如下:

  • advertiseAddress:更改为master的IP地址
  • criSocket:指定容器运行时
  • imageRepository:配置国内加速源地址
  • podSubnet:pod网段地址
  • serviceSubnet:services网段地址
  • 末尾添加了指定使用ipvs,开启systemd
  • nodeRegistration.name:改为当前主机名称

最终初始化配置文件如下:

apiVersion: kubeadm.k8s.io/v1beta3
bootstrapTokens:
- groups:
  - system:bootstrappers:kubeadm:default-node-token
  token: abcdef.0123456789abcdef
  ttl: 24h0m0s
  usages:
  - signing
  - authentication
kind: InitConfiguration
localAPIEndpoint:
  advertiseAddress: 16.32.15.200
  bindPort: 6443
nodeRegistration:
  criSocket: unix:///run/containerd/containerd.sock
  imagePullPolicy: IfNotPresent
  name: master-1
  taints: null
---
apiServer:
  timeoutForControlPlane: 4m0s
apiVersion: kubeadm.k8s.io/v1beta3
certificatesDir: /etc/kubernetes/pki
clusterName: kubernetes
controllerManager: {}
dns: {}
etcd:
  local:
    dataDir: /var/lib/etcd
imageRepository: registry.cn-hangzhou.aliyuncs.com/google_containers
kind: ClusterConfiguration
kubernetesVersion: 1.26.0
networking:
  dnsDomain: cluster.local
  podSubnet: 10.244.0.0/16
  serviceSubnet: 10.96.0.0/12
scheduler: {}
---
apiVersion: kubeproxy.config.k8s.io/v1alpha1
kind: KubeProxyConfiguration
mode: ipvs
---
apiVersion: kubelet.config.k8s.io/v1beta1
kind: KubeletConfiguration
cgroupDriver: systemd

3、进行初始化

kubeadm init --config=kubeadm.yaml --ignore-preflight-errors=SystemVerification

初始化成功后输出如下内容:

[init] Using Kubernetes version: v1.26.0
[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 in beforehand using 'kubeadm config images pull'
[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 [kubernetes kubernetes.default kubernetes.default.svc kubernetes.default.svc.cluster.local node] and IPs [10.96.0.1 16.32.15.200]
[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 [localhost node] and IPs [16.32.15.200 127.0.0.1 ::1]
[certs] Generating "etcd/peer" certificate and key
[certs] etcd/peer serving cert is signed for DNS names [localhost node] and IPs [16.32.15.200 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 "kubelet.conf" kubeconfig file
[kubeconfig] Writing "controller-manager.conf" kubeconfig file
[kubeconfig] Writing "scheduler.conf" kubeconfig file
[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
[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"
[etcd] Creating static Pod manifest for local etcd in "/etc/kubernetes/manifests"
[wait-control-plane] Waiting for the kubelet to boot up the control plane as static Pods from directory "/etc/kubernetes/manifests". This can take up to 4m0s
[apiclient] All control plane components are healthy after 12.003782 seconds
[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 node 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 node as control-plane by adding the taints [node-role.kubernetes.io/control-plane:NoSchedule]
[bootstrap-token] Using token: abcdef.0123456789abcdef
[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/

Then you can join any number of worker nodes by running the following on each as root:

kubeadm join 16.32.15.200:6443 --token abcdef.0123456789abcdef \
	--discovery-token-ca-cert-hash sha256:02dc7cc7702f9814d01f9a4d5957da3053e74adcc2f583415e516a4b81fb37bc

4、配置kubectl的配置文件config,相当于对kubectl进行授权,这样kubectl命令可以使用这个证书对k8s集群进行管理

mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config

验证使用可以使用 kubectl 命令

kubectl get nodes

5、查看镜像

ctr -n k8s.io images list
  • -n 指明名称空间

六、Node节点添加到集群

在两台node节点进行操

1、赋值初始化输出的token信息,在两台node节点执行

kubeadm join 16.32.15.200:6443 --token abcdef.0123456789abcdef \
	--discovery-token-ca-cert-hash sha256:6839bcc102c7ab089554871dd1a8f3d4261e1482ff13eafdf32fc092ebaf9f7e

如果忘记可以使用以下命令查看token,此命令含义是查看已经创建的token:

kubeadm token create --print-join-command

成功加入到集群如下图:

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-WcReqrzj-1682478646677)(D:\MD归档文档\IMG\image-20230425151533713.png)]

2、给两台node节点打上标签

master-1主机上执行

kubectl label nodes node-1 node-role.kubernetes.io/work=work
kubectl label nodes node-2 node-role.kubernetes.io/work=work

七、安装网络组件Calico

Calico在线文档地址:

Calico.yaml下载地址:

1、上传calico.yaml文件到服务器中,下面提供calico.yaml文件内容:

在master主机执行

kubectl apply -f  calico.yaml

2、查看集群状态 && 查看自带Pod状态

kubectl get nodes

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-wScfqriS-1682478646680)(D:\MD归档文档\IMG\image-20230426104418539.png)]

3、查看组件状态 是否为 Running状态 如下图:

kubectl get pods -n kube-system

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-ugY0UxIX-1682478646681)(D:\MD归档文档\IMG\image-20230426104559318.png)]

八、测试CoreDNS解析可用性

1、下载busybox:1.28镜像

ctr -n k8s.io images pull docker.io/library/busybox:1.28

2、测试coredns

kubectl run busybox --image busybox:1.28 --restart=Never --rm -it busybox -- sh

If you don't see a command prompt, try pressing enter.

/ # nslookup kubernetes.default.svc.cluster.local
Server:    10.96.0.10
Address 1: 10.96.0.10 kube-dns.kube-system.svc.cluster.local

Name:      kubernetes.default.svc.cluster.local
Address 1: 10.96.0.1 kubernetes.default.svc.cluster.local
  • 注意:busybox要用指定的1.28版本,不能用最新版本,最新版本,nslookup会解析不到dns和ip

九、拓展

1、ctr和crictl命令具体区别

ctr和crictl都是用于管理容器运行时的命令行工具,但它们的具体区别如下:

  • ctr是由Docker开发的,而crictl是由Kubernetes开发的。

  • ctr支持多种容器运行时,包括Docker、containerd、CRI-O等,而crictl只支持CRI(Container Runtime Interface)兼容的容器运行时,如CRI-O、containerd等。

  • ctr提供了更多的功能,如镜像管理、网络管理、卷管理等,而crictl只提供了基本的容器管理功能,如容器创建、删除、启动、停止等。

  • ctr的命令更加直观和易用,而crictl的命令更加符合Kubernetes的设计理念和规范。

综上所述,ctr和crictl都是优秀的容器管理工具,选择哪一个取决于具体的使用场景和需求。

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

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

相关文章

【c++ 之 多态】

目录&#xff1a; 前言多态认识多态多态的定义与实现构成多态的条件虚函数1.协变&#xff08;基类与派生类虚函数返回值不同&#xff09;2.析构函数的重写c11.两个虚函数修饰关键字&#xff1a;final & override 重载、重写、重定义再理解 抽象类抽象类的概念接口继承与实现…

强大的JSON格式化和编辑工具zjson

本文软件应网友 小超 的需求而制作&#xff0c;软件本身已经 2年未更新&#xff0c;请知悉~ 什么是 zjson ? 转杰森&#xff08;zjson&#xff09; 是一个强大的 JSON 格式化和编辑工具&#xff0c;支持在线版和 Electron应用安装&#xff0c;使用 MEAN-STACK ( MongoDB Expr…

【ArcGIS】常见问题总结

1 arcgis如何打开*.adf文件 在处理数据时发现&#xff0c;获取到的土地利用类型数据有两个文件夹&#xff0c;一个叫info&#xff0c;另一个叫lucc2010&#xff08;年份&#xff09;&#xff0c;打开lucc2010里面是一系列的*.adf文件&#xff0c;数据应该如何打开呢&#xff1…

Red Hat Enterprise Linux 9的简介

1.3 Red Hat Enterprise Linux 9的简介 2022年5月&#xff0c;红帽公司&#xff08;Red Hat&#xff09;发布了Red Hat Enterprise Linux 9.0&#xff08;简称RHEL 9.0&#xff09;正式版。Red Hat Enterprise Linux是全球领先的企业级Linux操作系统&#xff0c;已获得数百个…

重大剧透:你不用ChatGPT,它砸你饭碗

早晨看到路透社报道&#xff0c;盖茨说&#xff0c;与其争论技术的未来&#xff0c;不如专注于如何更好地利用人工智能。 这可能是他对马斯克他们呼吁暂停AI研发6个月的一种回应吧。 有种古语说&#xff1a;天下大势&#xff0c;浩浩汤汤&#xff0c;顺之者昌&#xff0c;逆之者…

ai模型训练生成效果 chilloutmix_NiPrunedFp32Fix.safetensors

模型名称&#xff1a; chilloutmix_NiPrunedFp32Fix.safetensors 关键词 extremely detailed CG unity 8k wallpaper,(masterpiece),(best quality),(ultra detailed),(ultra realistic),(Best character details:1.2),dynamic angle,professional lighting, photon mapping, …

【4. ROS的主要通讯方式:Topic话题与Message消息】

【4. ROS的主要通讯方式&#xff1a;Topic话题与Message消息】 1. 前言1.1 王者解释结点通讯&#xff1a;1.2 通讯小结 2. 灵活的Topic话题图解2.1 话题注意细节2.2 外延补充 3. Message消息图解3.1 消息类型3.2 查看标准消息类型std_msgs 4. 使用C实现Publisher发布者4.1 发布…

自动化工具 WEB 自动化工具

背景 使用自动化测试框架编写用例的时候&#xff0c;维护元素信息以及脚本较为麻烦。对应新手来说&#xff0c;编写脚本的能力有限&#xff0c;使用工具会更容易入手。最重要的是可视化操作让我觉得体验舒服。 演示地址 地址&#xff1a;hippo 账号&#xff1a;test 密码&am…

探索文件世界:用Python创建交互式文件浏览器

目录 引子&#xff1a; 应用场景&#xff1a; 源代码&#xff1a; 源代码说明&#xff1a; 效果如下所示: D:\spiderdocs\previewjpegmdfile.py 引子&#xff1a; 在许多应用程序中&#xff0c;需要方便地查看特定文件夹中的所有图片&#xff0c;例如图库管理器、相册应用…

泛型(一)

泛型&#xff1a;标签&#xff08;类型参数&#xff09; 所谓泛型&#xff0c;就是允许在定义类、接口时通过一个标识表示类中某个属性的类型或者是某个方法的返回值及参数类型。这个类型参数将在使用时&#xff08;例如&#xff0c;继承或实现这个接口&#xff0c;用这个类型…

Python 数据存储 ---->方式

我的个人博客主页&#xff1a;如果’真能转义1️⃣说1️⃣的博客主页 关于Python基本语法学习---->可以参考我的这篇博客&#xff1a;《我在VScode学Python》 数据存储是指在数据加工处理过程中将产生的临时文件或加工结果以某种格式保存。 常用的数据存储格式包括 TXT、Exc…

Java线程池常见面试题详解

线程池 池化技术 池化技术是一种常见的编程技巧, 把一些能够复用的东西&#xff08;比如说数据库连接、线程&#xff09;放到池中&#xff0c;避免重复创建、销毁的开销&#xff0c;在需要时可以重复使用这些预先准备的资源&#xff0c;从而极大提高性能。(提前保存大量资源,…

人生路上就是要不断打破认知边界

2023-4-25分享新知1.多角度看问题&#xff0c;竭尽全力才能找到突破口。结合客户需求解决问题2.新产品&有用的产品对用户提供有价值的产品3.全力就是所有部门都参与开发新产品&#xff0c;好机会就是有时间开发新产品&#xff0c;好产品就是一家企业的底气&#xff0c;产品…

SpringBoot 2.7.X 一套代码适配多种数据库讲解(图文详细)

文章目录 SpringBoot 2.7.X 一套代码适配多种数据库讲解(图文详细)1 简介1.1 概述1.2 环境安装1.3 测试脚本 2 基于Mybatis 方式2.1 添加DatabaseIdProvider配置2.2 在Mybatis的XML中,指定SQL语句的databaseId标签2.3 控制器接口样例2.4 呈现效果 3 基于MP框架Wrapps条件构造器…

AutoGPT也有Web UI了

AutoGPT能够在你的电脑上做任何你想做的事情&#xff0c;并且我们在前面的文章中也介绍了其他的一些类似的应用。 但是AutoGPT最大的一个问题是只能通过命令行界面(CLI)运行&#xff0c;这样就算是专业的技术人员使用起来也很麻烦&#xff0c;想想Stable Diffusion&#xff0c…

关于jeecgboot中遇到的问题及解决方案

1&#xff0c;关于数据权限问题 目的&#xff1a;一个人对应多个部门&#xff0c;部门下可能有子部门&#xff0c;过滤数据权限 解决方案&#xff1a; 方案①&#xff08;不推荐&#xff09;&#xff1a;如果后台是手写的sql&#xff08;没有用到mybatis-plus&#xff09;&…

一文弄懂标识符的规则和instanceof关键字

“世间有吸引法则&#xff0c;在于你有没有价值&#xff0c;价值来于物质资本和精神资本” 标识符的命名规则 标识符的含义&#xff1a;是指在程序中&#xff0c;我们自己定义的内容&#xff0c;例如方法名&#xff0c;变量名或者类名 命名规则&#xff1a;&#xff08;硬性要…

AlgoC++第六课:BP反向传播算法

目录 BP反向传播算法前言1. MNIST2. 感知机2.1 前言2.2 感知机-矩阵表示2.3 感知机-矩阵表示-多个样本2.4 感知机-增加偏置2.5 感知机-多个输出2.6 总结2.7 关于广播 3. BP4. 动量SGD5. BP示例代码总结 BP反向传播算法 前言 手写AI推出的全新面向AI算法的C课程 Algo C&#xf…

PHP、一:概述

1.概念 2.wampsever安装 百度搜索直接下载 下图是解压后目录&#xff0c;所写文件必须写在www文件夹下。 例&#xff1a;www文件夹下新建1.php&#xff0c;phpinfo()查看当前版本等信息。 使用localhost访问 php版本切换&#xff1a; 鼠标左键点击wampserver&#xff0c;切…

git rebase

git rebase rebase 是一个……我觉得很麻烦的指令&#xff0c;不过没办法&#xff0c;公司算是有个软规定必须要使用 rebase。 rebase 的功能和 merge 很像&#xff0c;不过它能够保持一个相对干净的历史&#xff0c;继续举个例子&#xff0c;假设现在有一个新的功能开发好了…