【云原生】k8s集群命令行工具kubectl之应用部署命令详解

kubectl应用部署命令详解

  • 一、准备工作
    • 1.1、Replication Controller
    • 1.2、Deployment
    • 1.3、DaemonSet
    • 1.4、查看创建的svc和pod
    • 1.5、kubectl 命令自动补全设置
  • 二、应用部署命令
    • 2.1、diff
    • 2.2、apply
    • 2.3、replace
    • 2.4、rollout
      • 2.4.1、history
      • 2.4.2、pause
      • 2.4.3、resume
      • 2.4.4、restart
      • 2.4.5、status
      • 2.4.6、undo
    • 2.5、scale
    • 2.6、autoscale
      • 2.6.1、metrics server
      • 2.6.1、metrics server 安装

一、准备工作

Kubernetes提供的集群控制平面(master节点)与Kubernetes APIServer通信的命令行工具——kubectl。kubectl默认配置文件目录$HOME/.kube/config。可以通过 --kubeconfig 参数来指定kubectl的配置文件。

以下操作如果已经做过了,就可以跳过。

1.1、Replication Controller

(1)创建myhello-rc.yaml并写入如下内容:

vim myhello-rc.yaml

内容:

apiVersion: v1
kind: ReplicationController # 副本控制器 RC
metadata:
  namespace: default
  name: myhello-rc # RC名称,全局唯一
  labels:
    name: myhello-rc
spec:
  replicas: 5 # Pod副本期待数量
  selector:
    name: myhello-rc-pod
  template: # pod的定义模板
    metadata:
      labels:
        name: myhello-rc-pod
    spec:
      containers: # Pod 内容的定义部分
      - name: myhello #容器的名称
        image: nongtengfei/hello:1.0.0 #容器对应的 Docker Image
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 80
        env: # 注入到容器的环境变量
        - name: env1
          value: "k8s-env1"
        - name: env2
          value: "k8s-env2"

通常不会去单独的配置pod,都是通过某一类副本控制器资源去部署pod。原因:如果单独配置pod,当集群升级时需要将当前节点上的所有pod排空,那么会产生问题,因为pod没有任何副本控制器在控制它,集群对他没有预期,当节点排空后,pod将不会被调度和重生。

(2)为RC创建service。

vim myhello-svc.yaml

内容:

apiVersion: v1
kind: Service
metadata:
  name: myhello-svc
  labels:
    name: myhello-svc
spec:
  type: NodePort # 对外提供端口
  ports:
  - port: 80
    protocol: TCP
    targetPort: 80
    name: http
    nodePort: 30000
  selector:
    name: myhello-rc-pod

(3)应用配置。

kubectl apply -f myhello-svc.yaml -f myhello-rc.yaml

1.2、Deployment

(1)创建myapp-deployment.yaml并写入如下内容:

vim myapp-deployment.yaml

内容:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: myapp-deployment
  labels:
    name: myapp-deploy
spec:
  replicas: 5
  selector:
    matchLabels:
      name: myapp-deploy-pod
  template:
    metadata:
      labels:
        name: myapp-deploy-pod
    spec:
     #nodeSelector:
       #nodetype: worker
      containers: # Pod 内容的定义部分
      - name: myhello #容器的名称
        image: nongtengfei/hello:1.0.0 #容器对应的 Docker Image
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 80
        env: # 注入到容器的环境变量
        - name: env1
          value: "k8s-env1"
        - name: env2
          value: "k8s-env2"
        resources:
          requests:
            cpu: 100m
      - name: myredis #容器的名称
        image: redis #容器对应的 Docker Image
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 6379
        env: # 注入到容器的环境变量
        - name: env1
          value: "k8s-env1"
        - name: env2
          value: "k8s-env2"
        resources:
          requests:
            cpu: 100m

(2)为deployment创建service。

vim myapp-svc.yaml

内容:

apiVersion: v1
kind: Service
metadata:
  name: myapp-svc
  labels:
    name: myapp-svc
spec:
  type: NodePort # 对外提供端口
  ports:
  - port: 80
    protocol: TCP
    targetPort: 80
    name: http
    nodePort: 30001
  selector:
    name: myapp-deploy-pod

(3)应用配置。

kubectl apply -f myapp-svc.yaml -f myapp-deployment.yaml

1.3、DaemonSet

(1)创建myapp-deployment.yaml并写入如下内容:

vim myapp-ds.yaml

内容:

apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: myapp-ds
  namespace: default
  labels:
    app: myapp-ds
spec:
  selector:
    matchLabels:
      app: myapp-ds
  template:
    metadata:
      labels:
        app: myapp-ds
    spec:
      tolerations:
      - key: node-role.kubernetes.io/control-plane
        operator: Exists
        effect: NoSchedule
      containers: # Pod 内容的定义部分
      - name: myhello #容器的名称
        image: nongtengfei/hello:1.0.0 #容器对应的 Docker Image
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 80
        env: # 注入到容器的环境变量
        - name: env1
          value: "k8s-env1"
        - name: env2
          value: "k8s-env2"

(2)为DaemonSet创建service。

vim myapp-ds-svc.yaml

内容:

apiVersion: v1
kind: Service
metadata:
  name: myapp-ds-svc
  labels:
    name: myapp-ds-svc
spec:
  type: NodePort # 对外提供端口
  ports:
  - port: 8080
    protocol: TCP
    targetPort: 80
    name: http
    nodePort: 30002
  selector:
    app: myapp-ds

(3)应用配置:

kubectl apply -f myapp-ds-svc.yaml -f myapp-ds.yaml

1.4、查看创建的svc和pod

$ kubectl get svc
NAME           TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)          AGE
kubernetes     ClusterIP   10.96.0.1       <none>        443/TCP          45h
myapp-ds-svc   NodePort    10.96.41.180    <none>        8080:30002/TCP   4m3s
myapp-svc      NodePort    10.98.20.127    <none>        80:30001/TCP     6m32s
myhello-svc    NodePort    10.106.252.61   <none>        80:30000/TCP     14m

$ kubectl get pod
NAME                                READY   STATUS    RESTARTS   AGE
myapp-deployment-5659dbddd8-l6m87   0/2     Pending   0          6m41s
myapp-deployment-5659dbddd8-lxxls   0/2     Pending   0          6m41s
myapp-deployment-5659dbddd8-pqqlx   0/2     Pending   0          6m41s
myapp-deployment-5659dbddd8-xb8xp   0/2     Pending   0          6m41s
myapp-deployment-5659dbddd8-zjgsx   0/2     Pending   0          6m41s
myapp-ds-2zqf9                      1/1     Running   0          2m43s
myhello-rc-2tjmr                    0/1     Pending   0          12m
myhello-rc-44ksd                    0/1     Pending   0          12m
myhello-rc-86g79                    0/1     Pending   0          12m
myhello-rc-df225                    0/1     Pending   0          12m
myhello-rc-lfbzb                    0/1     Pending   0          12m

这里只建立了一个节点,所有只有一个pod。

1.5、kubectl 命令自动补全设置

# 安装自动补全插件
sudo apt-get install -y bash-completion
# 添加.bashrc文件内容
echo "source <(kubectl completion bash)" >> ~/.bashrc
# 加载最新的.bashrc
source ~/.bashrc

二、应用部署命令

2.1、diff

显示目前版本与将要应用的版本之间的差异,仅对比yaml文件所定义的项目。
用法:

kubectl diff -f FILENAME

示例:

# 通过文件对比
kubectl diff -f myapp-deployment.yaml
# 通过输入对比
cat myapp-deployment.yaml | kubectl diff -f -
# 对比当前目录yaml后缀的文件
kubectl diff -f '*.yaml'

2.2、apply

基于文件或标准输入,将新的配置应用到资源上。
用法:

kubectl apply -f FILENAME

示例:

# 将配置应用到资源
kubectl apply -f myapp-deployment.yaml
# 通过输入的方式讲配置应用到资源
cat myapp-deployment.yaml | kubectl apply -f -
# 将当前目录yaml后缀的文件应用到资源
kubectl apply -f '*.yaml'

2.3、replace

基于文件或标准输入,将新的配置已替换的方式应用到资源上。
用法:

kubectl replace -f FILENAME

示例:

# 将配置应用到资源
kubectl replace -f myapp-deployment.yaml
# 通过输入的方式讲配置应用到资源
cat myapp-deployment.yaml | kubectl replace -f -

2.4、rollout

管理资源的上线,支持 deployments、daemonsets、statefulsets等资源对象。
用法:

kubectl rollout SUBCOMMAND

以下是支持的SUBCOMMAND。

2.4.1、history

查看历史修订版本和配置。
用法:

kubectl rollout history (TYPE NAME | TYPE/NAME) [flags]

示例:

# 查看DaemonSet/cadvisor 的发布历史
kubectl rollout history ds/myapp-ds
# 查看修订版本号为3的历史记录详细信息
kubectl rollout history daemonset/myapp-ds --revision=3

2.4.2、pause

将提供的资源标记为已暂停。控制器不会协调暂停的资源。使用“kubectl rollout resume”恢复暂停的资源。
当前仅支持 deployment 资源对象,由于deployment的滚动更新机制,如果在部署过程中使用了pause,将会导致一个部署中的pod版本不一致暂停 Deployment,然后再触发一个或多个更新,最后再继续(resume)该 Deployment。这种做法可以在暂停和继续中间对 Deployment 做多次更新,而无需触发不必要的滚动更新。简而言之:多次修改之后,在执行resume命令之后,对之前的修改一起反映到Pod。但是对服务的扩容和缩容不受暂停约束。

用法:

kubectl rollout pause RESOURCE

示例:

# 暂停部署
kubectl rollout pause deployment myapp-deployment

2.4.3、resume

恢复暂停的资源。

控制器不会协调暂停的资源。通过恢复资源,我们可以再次协调资源。当前仅支持恢复deployment。

用法:

kubectl rollout resume RESOURCE

示例:

kubectl rollout resume deployment myapp-deployment

2.4.4、restart

重启资源对象。
用法:

kubectl rollout restart RESOURCE

示例:

# 重启部署
kubectl rollout restart deployment/myapp-deployment
# 重启守护进程
kubectl rollout restart daemonset/myapp-ds
# 根据selector 重启部署
kubectl rollout restart deployment --selector=name=myapp-deploy

2.4.5、status

查看状态。
用法:

kubectl rollout status (TYPE NAME | TYPE/NAME) [flags]

示例:

# 查看发布状态
kubectl rollout status deployment/myapp-deployment

2.4.6、undo

回滚到之前版本。
用法:

kubectl rollout undo (TYPE NAME | TYPE/NAME) [flags]

示例:

# 回滚deployment/myapp-deployment 到上一个版本
kubectl rollout undo deployment/myapp-deployment
# 回滚到指定版本
kubectl rollout undo daemonset/myapp-ds --to-revision=2
# 演习回滚,查看结果。并未做真正的操作
kubectl rollout undo --dry-run=server deployment/myapp-deployment

注意:连续的undo,并不会一直往前回滚到很老的版本,而会在最近两个版本间来回切换。
示例:

# 分三次修改镜像版本,分别改为:1.0.0 1.0.1 1.0.2
kubectl edit ds/myapp-ds
# 回滚到上一个版本,查看详情镜像版本为:1.0.1
kubectl rollout undo ds/myapp-ds
# 回滚到上一个版本,查看详情镜像版本为:1.0.2
kubectl rollout undo ds/myapp-ds

2.5、scale

为deployment、replica set、 replication controller、statefulset 设置pod的副本数。
用法:

kubectl scale [--resource-version=version] [--current-replicas=count] --	replicas=COUNT (-f FILENAME | TYPE NAME)

示例:

# 修改副本数量为3
kubectl scale --replicas 3 deployment myapp-deployment
# 修改文件定义资源的副本数量为30
kubectl scale --replicas=30 -f myapp-deployment.yaml
# 如果当前副本数为30,则将副本数改为10
kubectl scale --current-replicas=30 --replicas=10 deployment/myapp-deployment
# 将指定 rc 和 deployment的副本数改为6
kubectl scale --replicas=6 rc/myhello-rc deployment/myapp-deployment

2.6、autoscale

创建自动缩放器,自动选择和设置在Kubernetes群集中运行的POD数。支持 deployment、replicaset、stateful set、replication controller等资源对象。当CPU或内存的使用率超过设定值之后,会开始自动扩容。当指标恢复之后,大约5分钟后,会开始缩容。自动伸缩的支持,必须为pod中每个容器设置所需最小资源。
用法:

kubectl autoscale (-f FILENAME | TYPE NAME | TYPE/NAME) [--min=MINPODS] --max=MAXPODS [--cpu-percent=CPU]

示例:

# 最少2个pod ,最多10个pod,采用默认缩放策略
kubectl autoscale deployment myapp-deployment --min=2 --max=10
# 最多15个pod,目标pod cpu利用率40%
kubectl autoscale deployment myapp-deployment --min=2 --max=15 --cpu-percent=40
# 查看自动扩展器
kubectl get horizontalpodautoscalers

2.6.1、metrics server

自动伸缩,必须安装metrics server。metrics server 用于获取节点指标。metrics server安装条件,k8s集群必须开启聚合层(默认已配置);节点kubelet 服务启用webhook鉴权(默认已启用)。
metrics server 启动项添加 --kubelet-insecure-tls 选项。
文档:

  1. metrics server。
  2. k8s 聚合层。
  3. k8s扩展服务。
  4. k8s webhook鉴权。
  5. 扩缩策略。

2.6.1、metrics server 安装

components.yaml

apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    k8s-app: metrics-server
  name: metrics-server
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  labels:
    k8s-app: metrics-server
    rbac.authorization.k8s.io/aggregate-to-admin: "true"
    rbac.authorization.k8s.io/aggregate-to-edit: "true"
    rbac.authorization.k8s.io/aggregate-to-view: "true"
  name: system:aggregated-metrics-reader
rules:
- apiGroups:
  - metrics.k8s.io
  resources:
  - pods
  - nodes
  verbs:
  - get
  - list
  - watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
  labels:
    k8s-app: metrics-server
  name: system:metrics-server
rules:
- apiGroups:
  - ""
  resources:
  - nodes/metrics
  verbs:
  - get
- apiGroups:
  - ""
  resources:
  - pods
  - nodes
  verbs:
  - get
  - list
  - watch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
  labels:
    k8s-app: metrics-server
  name: metrics-server-auth-reader
  namespace: kube-system
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: Role
  name: extension-apiserver-authentication-reader
subjects:
- kind: ServiceAccount
  name: metrics-server
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  labels:
    k8s-app: metrics-server
  name: metrics-server:system:auth-delegator
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: system:auth-delegator
subjects:
- kind: ServiceAccount
  name: metrics-server
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  labels:
    k8s-app: metrics-server
  name: system:metrics-server
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: system:metrics-server
subjects:
- kind: ServiceAccount
  name: metrics-server
  namespace: kube-system
---
apiVersion: v1
kind: Service
metadata:
  labels:
    k8s-app: metrics-server
  name: metrics-server
  namespace: kube-system
spec:
  ports:
  - name: https
    port: 443
    protocol: TCP
    targetPort: https
  selector:
    k8s-app: metrics-server
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    k8s-app: metrics-server
  name: metrics-server
  namespace: kube-system
spec:
  selector:
    matchLabels:
      k8s-app: metrics-server
  strategy:
    rollingUpdate:
      maxUnavailable: 0
  template:
    metadata:
      labels:
        k8s-app: metrics-server
    spec:
      containers:
      - args:
        - --cert-dir=/tmp
        - --kubelet-insecure-tls
        - --secure-port=4443
        - --kubelet-preferred-address-types=InternalIP,ExternalIP,Hostname
        - --kubelet-use-node-status-port
        - --metric-resolution=15s
        image: registry.aliyuncs.com/google_containers/metrics-server:v0.6.2
        imagePullPolicy: IfNotPresent
        livenessProbe:
          failureThreshold: 3
          httpGet:
            path: /livez
            port: https
            scheme: HTTPS
          periodSeconds: 10
        name: metrics-server
        ports:
        - containerPort: 4443
          name: https
          protocol: TCP
        readinessProbe:
          failureThreshold: 3
          httpGet:
            path: /readyz
            port: https
            scheme: HTTPS
          initialDelaySeconds: 20
          periodSeconds: 10
        resources:
            requests:
              cpu: 100m
              memory: 200Mi
        securityContext:
          allowPrivilegeEscalation: false
          readOnlyRootFilesystem: true
          runAsNonRoot: true
          runAsUser: 1000
        volumeMounts:
        - mountPath: /tmp
          name: tmp-dir
      nodeSelector:
        kubernetes.io/os: linux
      priorityClassName: system-cluster-critical
      serviceAccountName: metrics-server
      volumes:
      - emptyDir: {}
        name: tmp-dir
---
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
  labels:
    k8s-app: metrics-server
  name: v1beta1.metrics.k8s.io
spec:
  group: metrics.k8s.io
  groupPriorityMinimum: 100
  insecureSkipTLSVerify: true
  service:
    name: metrics-server
    namespace: kube-system
  version: v1beta1
  versionPriority: 100

执行:

kubectl apply -f components.yaml

在这里插入图片描述

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

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

Java 常量池分析

Java常量池 常量池&#xff1a;存放所有常量 常量池是Class文件中内容最为丰富的区域。常量池对于Class文件中的字段和方法解析也有着至关重要的作用。 随着Java虚拟机的不断发展&#xff0c;常量池的内容也日渐丰富。可以说&#xff0c;常量池是整个Class文件的基石。 在版…

HMC717ALP3E-ASEMI代理ADI(亚德诺)车规级芯片HMC717ALP3E

编辑-Z HMC717ALP3E参数描述&#xff1a; 频率范围&#xff1a;4.8 - 6.0GHz 增益&#xff1a;12.5dB 噪声系数&#xff1a;1.3dB 输入回波损耗&#xff1a;8dB 输出回波损耗&#xff1a;13dB 1 dB压缩的输出功率&#xff08;P1dB&#xff09;&#xff1a;12dBm 饱和输…

2023首届大学生算法大赛 - 村庄

读题可以发现&#xff0c;如果两个村庄不能互相连通&#xff0c;那就算作一对 &#xff08;a<b&#xff09;。 显然是可以用floyd全局多源最短路来做的&#xff0c;如果不存在最短路&#xff0c;那么就是不能互通&#xff0c;但是这道题的数据范围N<10^5&#xff0c;跑f…

SpringCloud之Eureka原理分析与实战(注册与发现)

目录 1、从本质理解服务治理思想 2、为什么选择Spring Cloud服务治理组件 3、Spring Cloud Eureka服务发现 3.1 Eureka的优势 3.2 Eureka架构组成 3.3 搭建Eureka Server 实战 3.3.1 添加依赖 3.3.2 开启服务注册 3.3.3 添加YML配置 3.3.4 访问服务 3.4 搭建Eureka …

IT服务商服务运营方案--PIGOSS BSM +TOC 服务加工具的新型运维模式

该解决方案适用于各种数据中心端专业运维服务商&#xff0c;包括驻场服务商&#xff0c;MA服务商&#xff0c;ITO服务商&#xff0c;IDC服务商&#xff0c;云运维服务商等 PIGOSS 是专业服务商的共同选择 专业的服务团队离不开专业的技术平台和技术工具&#xff0c;PIGOSS TOC…

echarts柱状图

1、先展示效果图 2、直接上代码&#xff0c;copy代码进行调试便会懂&#xff08;导入echarts插件看之前的文章&#xff09; <template><div class"antigen-container"><div class"top-content"><span class"top-title"&g…

电商商品详情API接口,python请求示例说明

PC端商品详情接口&#xff0c;H5商品详情接口&#xff0c;APP商品详情接口&#xff0c;商品详情接口&#xff0c;商品销量接口&#xff0c;商品列表接口&#xff0c;商品属性接口&#xff0c;商品sku接口&#xff0c;商品评论接口&#xff0c;商品优惠价接口&#xff0c;商品历…

求职咨询Job Information

前言 加油 原文 求职咨询常用会话 ❶ I want to apply for a job which enables me to use my major. 我想要申请一个能用到我的专业知识的职业。 ❷ I have the capability of operating the computer. 我有操作电脑的能力。 ❸ My dream is to be an excellent interpret…

ts基础内容

javascript脚本语言简称ts为javascript进阶脚本语法 TypeScript是微软开发的一个开源的编程语言&#xff0c;通过在JavaScript的基础上添加静态类型定义构建而成。TypeScript通过TypeScript编译器或Babel转译为JavaScript代码&#xff0c;可运行在任何浏览器&#xff0c;任何操…

Python 字符串格式化高级用法

字符串格式化: 是在编程过程中&#xff0c;允许编码人员通过特殊的占位符&#xff0c;将相关对应的信息整合或提取的规则字符串。 python字符串格式化字符串的格式化常用的三种方式&#xff0c;分别是使用 %格式化&#xff0c;format方法格式化&#xff0c;fstring格式化。 传…

元数据管理概述

参考公众号文章&#xff1a;数据治理&#xff1a;元数据及元数据管理策略、方法和技术

走进小程序【一】什么是小程序?

文章目录&#x1f31f;前言&#x1f31f;发展史&#x1f31f;什么是[微信小程序](https://developers.weixin.qq.com/miniprogram/dev/framework/)&#xff1f;&#x1f31f;微信小程序能做什么&#xff1f;&#x1f31f;小程序发展前景和优势&#x1f31f;写在最后&#x1f31…

应用层 —— HTTPS协议

目录 1、HTTPS介绍 HTTP 与 HTTPS "加密" 是什么 常见的加密方式 对称加密 非对称加密 数据摘要 && 数据指纹 数字签名 2、HTTPS的工作过程探究 方案1 —— 只使用对称加密&#xff08;明文传输不可取&#xff09; 方案2 —— 只使用非对称加密&#xff08…

【探花交友】day02—完善个人信息

目录 1、完善用户信息 1.1、阿里云OSS 1.2、百度人脸识别 1.3、保存用户信息 1.4、上传用户头像 2、用户信息管理 2.1、查询用户资料 2.2、更新用户资料 3、统一token处理 3.1、代码存在的问题 3.2、解决方案 3.3、代码实现 4、统一异常处理 4.1、解决方案 4.2、…

「从零入门推荐系统」14:推荐系统冷启动

作者 | gongyouliu编辑 | gongyouliu作者在第2章《推荐系统基础介绍》中讲述推荐系统面临的挑战时提到冷启动是推荐系统的重要挑战之一。冷启动问题是推荐系统工程实践中非常重要的一个问题&#xff0c;只有解决好冷启动问题&#xff0c;推荐系统的用户体验才会更好。有很多读者…

首届“兴智杯”产业赛收官,文心大模型助推产业创新

由工业和信息化部、科学技术部、深圳市人民政府共同主办&#xff0c;中国信通院等单位承办的首届“兴智杯”全国人工智能创新应用大赛圆满收官。本次大赛受到国家部委、政府机构、科技企业、高校师生等社会各界密切关注。为了进一步激发创新活力&#xff0c;促进人工智能核心技…

ChatGPT 本地部署及搭建

这篇简要说下清华开源项目 ChatGLM 本地部署的详细教程。清华开源项目 ChatGLM-6B 已发布开源版本&#xff0c;这一项目可以直接部署在本地计算机上做测试&#xff0c;无需联网即可体验与 AI 聊天的乐趣。 项目地址&#xff1a;GitHub - THUDM/ChatGLM-6B: ChatGLM-6B&#xf…

创建网络数据集

目的&#xff1a;主要是用来做路径规划。 第一步&#xff1a;加载用作构建网络数据集的道路网数据到arcmap。 第二步&#xff1a;做打断处理。【如果线数据未做过打断处理&#xff0c;需要做这一步。】 有两种方式【1、编辑器里面的高级编辑器的打断相交线功能&#xff1b;2、…

带你玩转Python爬虫(胆小者勿进)千万别做坏事·······

这节课很危险&#xff0c;哈哈哈哈&#xff0c;逗你们玩的 目录 写在前面 1 了解robots.txt 1.1 基础理解 1.2 使用robots.txt 2 Cookie 2.1 两种cookie处理方式 3 常用爬虫方法 3.1 bs4 3.1.1 基础介绍 3.1.2 bs4使用 3.1.2 使用例子 3.2 xpath 3.2.1 xpath基础介…
最新文章