k8s搭建部署3个节点服务器

2023-11-10

目录

一、环境准备

二、安装kubeadm,kubelet和kubectl

三、部署kubernetes Master

四、node节点加入集群

五、查看集群的状态

Init:ImagePullBackOff错误

swap分区没有关闭

 没有coredns镜像


一、环境准备

硬件环境要求:CPU 2核        Memory 2G

软件环境要求:CentOS Linux release 8.3.2011

三台机器:

IP:192.168.10.188        主机名:master

IP:192.168.10.189        主机名:node1

IP:192.168.10.190        主机名:node2

三台服务器都要进行以下操作,所以主机名用localhost代替

#解决依赖关系
[root@localhost ~]# yum install -y yum-utils zlib zlib-devel openssl openssl-devel pcre pcre-devel gcc gcc-c++ autoconf automake make  psmisc  lsof  net-tools vim python3

#临时关闭防火墙
[root@localhost ~]# systemctl stop firewalld
#设置开机关闭防火墙
[root@localhost ~]# systemctl disable firewalld

#临时关闭selinux
[root@localhost ~]# setenforce 0
#永久关闭selinux
[root@localhost ~]# vim /etc/selinux/config
SELINUX=disabled    #将SELINUX设置成disabled

安装docker

#卸载旧版本
[root@localhost ~]# yum remove docker \
>                   docker-client \
>                   docker-client-latest \
>                   docker-common \
>                   docker-latest \
>                   docker-latest-logrotate \
>                   docker-logrotate \
>                   docker-engine

#安装yum-utils软件包(提供yum-config-manager应用程序)
[root@localhost ~]# yum install -y yum-utils

#配置加速源
[root@localhost ~]# yum-config-manager \
>     --add-repo \
>         http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo


#安装docker,设置开机启动
[root@localhost ~]# yum install -y docker-ce docker-ce-cli containerd.io
[root@localhost ~]# systemctl start docker
[root@localhost ~]# systemctl enable docker
#配置docker使用systemd作为默认Cgroup驱动
[root@localhost ~]# cat <<EOF > /etc/docker/daemon.json
> {
>    "exec-opts": ["native.cgroupdriver=systemd"]
> }
> EOF

#重启docker
[root@localhost ~]# systemctl restart docker

#关闭swap分区
#临时关闭
[root@localhost ~]# swapoff -a 
#永久关闭
[root@localhost ~]# sed -i '/ swap / s/^\(.*\)$/#\1/g' /etc/fstab 

#重新命名主机
hostnamectl set-hostname master

hostnamectl set-hostname node1

hostnamectl set-hostname node2

使用 su - root 切换用户重新登陆

#每台机器上修改/etc/hosts文件

cat >> /etc/hosts << EOF 
192.168.0.188 master
192.168.0.189 node1
192.168.0.190 node2
EOF

二、安装kubeadm,kubelet和kubectl

每台服务器上都要安装

#添加kubernetes YUM软件源
[root@localhost ~]# cat > /etc/yum.repos.d/kubernetes.repo << EOF
> [kubernetes]
> name=Kubernetes
> baseurl=https://mirrors.aliyun.com/kubernetes/yum/repos/kubernetes-el7-x86_64
> enabled=1
> gpgcheck=0
> repo_gpgcheck=0
> gpgkey=https://mirrors.aliyun.com/kubernetes/yum/doc/yum-key.gpg https://mirrors.aliyun.com/kubernetes/yum/doc/rpm-package-key.gpg
> EOF

#安装kubeadm,kubelet和kubectl
[root@localhost ~]# yum install -y kubelet kubeadm kubectl

#设置开机自启
[root@localhost ~]# systemctl enable kubelet

三、部署kubernetes Master

#提前准备coredns:1.8.4的镜像,后面需要使用,需要在每台机器上下载镜像
[root@master ~]# docker pull  coredns/coredns:1.8.4
[root@master ~]# docker tag coredns/coredns:1.8.4 registry.aliyuncs.com/google_containers/coredns:v1.8.4

#初始化操作在master服务器上执行
[root@master ~]# kubeadm init \
> --apiserver-advertise-address=192.168.10.188 \
> --image-repository registry.aliyuncs.com/google_containers \
> --service-cidr=10.1.0.0/16 \
> --pod-network-cidr=10.244.0.0/16

...
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 192.168.10.188:6443 --token l9posz.ca7citx3ig5vpsqg \
	--discovery-token-ca-cert-hash sha256:7229c76950a7b82f64ff14a72c3ef81bad0f8f02c553861ff63f48b2904dd55e 


[root@master ~]# mkdir -p $HOME/.kube
[root@master ~]# sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
[root@master ~]# sudo chown $(id -u):$(id -g) $HOME/.kube/config

#在master服务器上执行
[root@node1 ~]# cat kube-flannel.yml
---
apiVersion: policy/v1beta1
kind: PodSecurityPolicy
metadata:
  name: psp.flannel.unprivileged
  annotations:
    seccomp.security.alpha.kubernetes.io/allowedProfileNames: docker/default
    seccomp.security.alpha.kubernetes.io/defaultProfileName: docker/default
    apparmor.security.beta.kubernetes.io/allowedProfileNames: runtime/default
    apparmor.security.beta.kubernetes.io/defaultProfileName: runtime/default
spec:
  privileged: false
  volumes:
  - configMap
  - secret
  - emptyDir
  - hostPath
  allowedHostPaths:
  - pathPrefix: "/etc/cni/net.d"
  - pathPrefix: "/etc/kube-flannel"
  - pathPrefix: "/run/flannel"
  readOnlyRootFilesystem: false
  # Users and groups
  runAsUser:
    rule: RunAsAny
  supplementalGroups:
    rule: RunAsAny
  fsGroup:
    rule: RunAsAny
  # Privilege Escalation
  allowPrivilegeEscalation: false
  defaultAllowPrivilegeEscalation: false
  # Capabilities
  allowedCapabilities: ['NET_ADMIN', 'NET_RAW']
  defaultAddCapabilities: []
  requiredDropCapabilities: []
  # Host namespaces
  hostPID: false
  hostIPC: false
  hostNetwork: true
  hostPorts:
  - min: 0
    max: 65535
  # SELinux
  seLinux:
    # SELinux is unused in CaaSP
    rule: 'RunAsAny'
---
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: flannel
rules:
- apiGroups: ['extensions']
  resources: ['podsecuritypolicies']
  verbs: ['use']
  resourceNames: ['psp.flannel.unprivileged']
- apiGroups:
  - ""
  resources:
  - pods
  verbs:
  - get
- apiGroups:
  - ""
  resources:
  - nodes
  verbs:
  - list
  - watch
- apiGroups:
  - ""
  resources:
  - nodes/status
  verbs:
  - patch
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
metadata:
  name: flannel
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: flannel
subjects:
- kind: ServiceAccount
  name: flannel
  namespace: kube-system
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: flannel
  namespace: kube-system
---
kind: ConfigMap
apiVersion: v1
metadata:
  name: kube-flannel-cfg
  namespace: kube-system
  labels:
    tier: node
    app: flannel
data:
  cni-conf.json: |
    {
      "name": "cbr0",
      "cniVersion": "0.3.1",
      "plugins": [
        {
          "type": "flannel",
          "delegate": {
            "hairpinMode": true,
            "isDefaultGateway": true
          }
        },
        {
          "type": "portmap",
          "capabilities": {
            "portMappings": true
          }
        }
      ]
    }
  net-conf.json: |
    {
      "Network": "10.244.0.0/16",
      "Backend": {
        "Type": "vxlan"
      }
    }
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: kube-flannel-ds
  namespace: kube-system
  labels:
    tier: node
    app: flannel
spec:
  selector:
    matchLabels:
      app: flannel
  template:
    metadata:
      labels:
        tier: node
        app: flannel
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: kubernetes.io/os
                operator: In
                values:
                - linux
      hostNetwork: true
      priorityClassName: system-node-critical
      tolerations:
      - operator: Exists
        effect: NoSchedule
      serviceAccountName: flannel
      initContainers:
      - name: install-cni
        image: quay.io/coreos/flannel:v0.13.1-rc2
        command:
        - cp
        args:
        - -f
        - /etc/kube-flannel/cni-conf.json
        - /etc/cni/net.d/10-flannel.conflist
        volumeMounts:
        - name: cni
          mountPath: /etc/cni/net.d
        - name: flannel-cfg
          mountPath: /etc/kube-flannel/
      containers:
      - name: kube-flannel
        image: quay.io/coreos/flannel:v0.13.1-rc2
        command:
        - /opt/bin/flanneld
        args:
        - --ip-masq
        - --kube-subnet-mgr
        resources:
          requests:
            cpu: "100m"
            memory: "50Mi"
          limits:
            cpu: "100m"
            memory: "50Mi"
        securityContext:
          privileged: false
          capabilities:
            add: ["NET_ADMIN", "NET_RAW"]
        env:
        - name: POD_NAME
          valueFrom:
            fieldRef:
              fieldPath: metadata.name
        - name: POD_NAMESPACE
          valueFrom:
            fieldRef:
              fieldPath: metadata.namespace
        volumeMounts:
        - name: run
          mountPath: /run/flannel
        - name: flannel-cfg
          mountPath: /etc/kube-flannel/
      volumes:
      - name: run
        hostPath:
          path: /run/flannel
      - name: cni
        hostPath:
          path: /etc/cni/net.d
      - name: flannel-cfg
        configMap:
          name: kube-flannel-cfg

#部署flannel
[root@master ~]# kubectl apply -f kube-flannel.yml

#查看是否部署成功
[root@master ~]# ps aux|grep flannel
root       14365  0.2  2.0 1339652 36952 ?       Ssl  9月06   0:11 /opt/bin/flanneld --ip-masq --kube-subnet-mgr
root       45591  0.0  0.0  12344  1148 pts/0    S+   00:17   0:00 grep --color=auto flannel

四、node节点加入集群

[root@node1 ~]# kubeadm join 192.168.10.188:6443 --token l9posz.ca7citx3ig5vpsqg \
> --discovery-token-ca-cert-hash sha256:7229c76950a7b82f64ff14a72c3ef81bad0f8f02c553861ff63f48b2904dd55e

[root@node2 ~]# kubeadm join 192.168.10.188:6443 --token l9posz.ca7citx3ig5vpsqg \
> --discovery-token-ca-cert-hash sha256:7229c76950a7b82f64ff14a72c3ef81bad0f8f02c553861ff63f48b2904dd55e

This node has joined the cluster:
* Certificate signing request was sent to apiserver and a response was received.
* The Kubelet was informed of the new secure connection details.

Run 'kubectl get nodes' on the control-plane to see this node join the cluster.

五、查看集群的状态

#等待节点准备完毕,需要等待几分钟
[root@master ~]# kubectl get nodes
NAME     STATUS     ROLES                  AGE   VERSION
master   Ready      control-plane,master   63m   v1.22.1
node1    Ready      <none>                 10m   v1.22.1
node2    Ready      <none>                 12m   v1.22.1

[root@master ~]# kubectl get pod -n kube-system
NAME                             READY   STATUS    RESTARTS   AGE
coredns-7f6cbbb7b8-p7v7v         1/1     Running   0          67m
coredns-7f6cbbb7b8-qzdbr         1/1     Running   0          67m
etcd-master                      1/1     Running   0          67m
kube-apiserver-master            1/1     Running   0          67m
kube-controller-manager-master   1/1     Running   0          67m
kube-flannel-ds-fgk2n            1/1     Running   0          14m
kube-flannel-ds-sh2m4            1/1     Running   0          65m
kube-proxy-hcdjw                 1/1     Running   0          67m
kube-proxy-j5qgx                 1/1     Running   0          14m
kube-scheduler-master            1/1     Running   0          67m

Init:ImagePullBackOff错误

#查看具体的出错信息
[root@node1 ~]# kubectl describe pod kube-flannel-ds-p4nx9 --namespace=kube-system


Normal   BackOff    16m (x4 over 26m)    kubelet            Back-off pulling image "quay.io/coreos/flannel:v0.13.1-rc2"
  Warning  Failed     16m (x4 over 26m)    kubelet            Error: ImagePullBackOff
  Warning  Failed     6m21s (x2 over 16m)  kubelet            Failed to pull image "quay.io/coreos/flannel:v0.13.1-rc2": rpc error: code = Unknown desc = context canceled
  Warning  Failed     6m21s (x4 over 26m)  kubelet            Error: ErrImagePull
  Normal   Pulling    6m10s (x5 over 26m)  kubelet            Pulling image "quay.io/coreos/flannel:v0.13.1-rc2"

#手动拉取镜像
[root@node1 ~]# docker pull quay.io/coreos/flannel:v0.13.1-rc2
v0.13.1-rc2: Pulling from coreos/flannel
df20fa9351a1: Already exists 
0fbfec51320e: Already exists 
734a6c0a0c59: Already exists 
95bcce43aaee: Pull complete 
f5cb02651392: Pull complete 
071b96dd834b: Pull complete 
164ad1e8ed3f: Pull complete

#查看镜像
[root@node1 ~]# docker images
REPOSITORY                                                        TAG           IMAGE ID       CREATED        SIZE
registry.aliyuncs.com/google_containers/kube-apiserver            v1.22.1       f30469a2491a   2 weeks ago    128MB
registry.aliyuncs.com/google_containers/kube-scheduler            v1.22.1       aca5ededae9c   2 weeks ago    52.7MB
registry.aliyuncs.com/google_containers/kube-proxy                v1.22.1       36c4ebbc9d97   2 weeks ago    104MB
registry.aliyuncs.com/google_containers/kube-controller-manager   v1.22.1       6e002eb89a88   2 weeks ago    122MB
registry.aliyuncs.com/google_containers/etcd                      3.5.0-0       004811815584   2 months ago   295MB
coredns/coredns                                                   1.8.4         8d147537fb7d   3 months ago   47.6MB
registry.aliyuncs.com/google_containers/coredns                   v1.8.4        8d147537fb7d   3 months ago   47.6MB
registry.aliyuncs.com/google_containers/pause                     3.5           ed210e3e4a5b   5 months ago   683kB
quay.io/coreos/flannel                                            v0.13.1-rc2   dee1cac4dd20   7 months ago   64.3MB

#查看flannel启动成功
[root@node1 ~]# ps aux|grep flannel
root       14856  0.0  2.0 1265920 37932 ?       Ssl  20:54   0:00 /opt/bin/flanneld --ip-masq --kube-subnet-mgr
root       16946  0.0  0.0  12344  1028 pts/0    S+   20:59   0:00 grep --color=auto flannel


swap分区没有关闭

出现这种故障,swapoff -a关闭交换分区即可

 没有coredns镜像

 手动拉取镜像

#提前准备coredns:1.8.4的镜像,后面需要使用,需要在每台机器上下载镜像
[root@master ~]# docker pull  coredns/coredns:1.8.4
[root@master ~]# docker tag coredns/coredns:1.8.4 registry.aliyuncs.com/google_containers/coredns:v1.8.4

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

k8s搭建部署3个节点服务器 的相关文章

  • 将 Docker 与 AWS Elastic Beanstalk 结合使用有哪些优势?

    我在AWS Elastic Beanstalk上部署了几个网站 然后我听说了Docker 所以我想这次我可以尝试一下小型企业电子商务网站 Lumen Angularjs 网上查遍了 由于没有使用Docker的经验 还是很难 深入了解在 AW
  • 无法连接到代理“证书由未知机构签名”

    我正在尝试通过 Kubernetes 部署上的 cloudsql proxy 容器连接到 CloudSQL 实例 我已安装 cloudsql 凭据以及值GOOGLE APPLICATION CREDENTIALS set 但是 我的日志中仍
  • Windows 8.1可以安装Docker吗?

    我想使用 Docker 将带有 NET Core 3 1 的 Web 应用程序部署到 Heroku 我下载了它 然后告诉我应该使用 Windows 10 适用于 Windows 的 Docker 需要 Windows 10 如果您使用 Wi
  • Docker pull:不允许操作

    我在拉取一些 docker 映像 但不是全部 时收到此错误 failed to register layer Error processing tar file exit status 1 operation not permitted 例
  • Kubernetes Python 客户端连接问题

    我已经设置了官方 Kubernetes Python 客户端 https github com kubernetes client python https github com kubernetes client python 我正在运行
  • 带有 Helm Charts 的蓝绿部署

    我们可以使用 Helm Charts 来部署应用程序 helm install name the release helm the service helm namespace myns 而我们冷 滚动升级 部署使用 helm upgrad
  • 如何使用 nginx 入口控制器仅允许每个 pod 建立一个连接

    我的 Kubernetes 集群使用副本集来运行 N 个相似的 pod 由于资源限制 每个 Pod 只能处理一个 WebSocket 连接 我的 Kubernetes 使用 nginx 入口控制器 有没有办法让 nginx 每个 pod 仅
  • kubernetes master 的 x509 证书无效

    我正在尝试从我的工作站访问我的 k8s master 我可以从 LAN 很好地访问主站 但不能从我的工作站访问 错误信息是 kubectl context employee context get pods Unable to connec
  • Kubernetes,无法访问其他节点服务

    我正在 3 个带有 CentOS 7 的 VirtualBox 虚拟机 1 个 master 和 2 个 minions 中使用 Kubernetes 不幸的是安装手册说的是这样的every service will be accessib
  • Helm 查找始终为空

    在部署 Kubernetes 应用程序时 我想检查资源是否已存在 如果是这样 则不应渲染 要存档此行为查找功能 https helm sh docs chart template guide functions and pipelines
  • python:PyPi公共模块:如何确定是否安全?

    我已经完成了我的 python 3 应用程序 它正在使用 PyPi 的多个公共模块 然而 在我将其部署到我公司的企业 将处理客户的凭据并访问第 3 方 API 之前 我需要尽职调查确保它们既安全又安全 我必须执行哪些步骤 验证 PyPi 模
  • 如何检查docker中当前/默认的日志驱动程序?

    我正在尝试检查已停止的 docker 容器的日志 但是当我这样做时docker logs
  • 在docker中使用MySQL数据库设置aspnetcore

    我正在尝试设置一个 docker compose 文件 其中包含 asp net core mysql 数据库和 phpmyadmin 的容器 设置我的 mysql 服务器没有问题 我可以使用 phpmyadmin 访问它 我的 asp n
  • 从 Docker 容器发送多播数据包(到多播组)

    我有一个通过 UDP 多播发送消息的应用程序 我一直试图将其放在 docker 下 我在尝试从 Docker 容器发送多播数据包时遇到了很大的阻力 我已经能够通过 net host运行 docker 容器的选项 然而 我想坚持使用桥接配置
  • Nextjs 无法在生产环境中的“.next”目录中找到有效的构建

    我正在 docker 中运行我的应用程序 但我的生产构建和启动脚本仅在 docker 环境中失败 虽然node env开发在docker环境下运行良好 这是我的脚本 无法进行生产构建并启动服务器 我正在使用nodemon和babel bui
  • Kubernetes 的调度器是如何工作的?

    Kubernetes 的调度器是如何工作的 我的意思是说Kubernetes的调度器看起来很简单 我最初的想法是这个调度器只是一个简单的准入控制系统 而不是真正的调度器 是这样正确的吗 我找到了一个简短的描述 但信息并不丰富 kuberne
  • 无法从我的电脑上使用 traefik 后面的 gitlab 进行 git 克隆

    这是我的 gitlab 和 traefik 配置 version 3 7 services gitlab web image gitlab gitlab ce latest restart always hostname gitlab ro
  • 仅使用containerd(不使用Docker)修剪容器镜像

    如果我刚刚containerd安装在 Linux 系统上 即 Docker 是not安装 如何删除未使用的容器映像以节省磁盘空间 Docker 就是这么方便docker system prune https docs docker com
  • Docker Compose 无法连接到数据库

    我使用 Nestjs 作为后端 并使用 typeorm 作为 ORM 我尝试在 docker compose 文件中定义我的数据库和应用程序 如果我将数据库作为容器运行 并从本地计算机运行应用程序 那么它运行良好 我的程序连接并创建表等 但
  • 如何从 Docker Hub 删除存储库

    如何从 Docker Hub 完全删除存储库 Docker 正在快速发展 他们的网站也是如此 这是从 docker hub Web 界面删除存储库的最新方法 首先 确保您已登录 hub docker com Simple 单击顶部的存储库链

随机推荐

  • 源码分析spring容器启动销毁资源

    文章目录 一 InitializingBean 二 SmartInitializingSingleton 三 PostConstruct 四 DisposableBean 五 PreDestroy 六 BeanPostProcessor 七
  • nginx(一)下载、安装、启动、关闭(Windows)

    前言 我们现在部署项目用nginx的是比较普遍的 这里分享一些资料 1 下载安装包 官网入口 提供了 window和linux两个版本 根据自己需要来下载 我这里是window 2 打开下载的压缩包 目录如下 启动服务 双击运行nginx
  • python 常见入门问题一

    python 常见入门问题一 入门的第一个问题 TypeError can only concatenate str not int to str 在python中 中为字符串不能直接和int类型的数字相加 说到相加 C语言也有类似的cha
  • Kotlin协程视频教程,极简入门与解密

    Kotlin协程极简入门与解密视频教程已经发布到CSDN学院 https edu csdn net course detail 31728 Kotlin作为目前最为流行的编程语言之一 学Kotlin的同学们都被Kotlin的简洁的语法和它强
  • oracle replace怎么用,oracle replace()函数用法

    用法介绍 REPLACE char search string replacement string char 等待替换的字符串 search string 搜索需要替换的字符串 replacement string 替换字符串 如果rep
  • XGboost进行时间序列预测

    文章最前 我是Octopus 这个名字来源于我的中文名 章鱼 我热爱编程 热爱算法 热爱开源 所有源码在我的个人github 这博客是记录我学习的点点滴滴 如果您对 Python Java AI 算法有兴趣 可以关注我的动态 一起学习 共同
  • 跳出弹窗页面禁止滚动(PC端和手机端)

    pc端如何实现 1 当弹窗显示时 为body元素添加属性 overflow hidden 当关闭弹窗时移除该属性即可2 在弹窗的div上设置 scroll stop prevent div 你要显示的内容 div 3 出现弹窗时 为body
  • 移动应用开发---uni-app框架

    目录 一 什么是uni app 二 环境搭建 三 uni app的构造 四 uni app框架主要有五大优势 五 运行项目 六 发布小程序 发布为微信小程序 发布为支付宝小程序 一 什么是uni app uni app 是一个使用 Vue
  • 数据库查询的基本运算,关系代数

    1 关系属性的指定 投影运算 这个操作是对一个关系进行垂直分割 消去某些列 并重新安排列的顺序 为投影运算符 表示按照i1 i2 in的顺序从关系R中取出n列 并删除结果中的重复元组 组成一个新的以i1 i2 in为列顺序的n元关系 2 关
  • doker部署postgres

    doker部署postgres 参考该博文 1 安装docker sudo apt get update sudo apt get install docker 2 在docker里面安装postgres镜像 docker pull pos
  • 第14.9节 Python中使用urllib.request+BeautifulSoup获取url访问的基本信息

    利用urllib request读取url文档的内容并使用BeautifulSoup解析后 可以通过一些基本的BeautifulSoup对象输出html文档的基本信息 以博文 第14 6节 使用Python urllib request模拟
  • c++11/14之std::shared_ptr作为引用参数,普通参数

    1 c 中使用std shared ptr类型做为构造函数参数 并使用std move 初始化成员变量 使用std shared ptr类型作为形参 shared ptr会被复制 使用std move 之后 形参对象就没有内容了 inclu
  • java根据生日计算年龄工具类

    在开发中时常遇到要通过生日计算年龄的需求 这里记录一下 private static int getAgeByBirth Date birthday int age 0 try Calendar now Calendar getInstan
  • linux强制卸载mysql报错

    error Failed dependencies mysql community client x86 64 gt 8 0 11 is needed by installed mysql community server 8 0 31 1
  • html在线校验器,HTML validate HTML验证

    HTML validate是指HTML验证 它是通过与标准HTML规则进行比较的方式 分析HTML文档 标记出错误和非标准代码的处理过程 Web页面使用HTML进行渲染 而HTML本身采用了HTML规范作为其规则和标准 通过验证HTML代码
  • 驱动开发 作业 day9 9/20

    基于platform实现 head h ifndef HEAD H define HEAD H 构建LED开关的功能码 不添加ioctl第三个参数 define LED ON IO l 1 define LED OFF IO l 0 end
  • 同时安装cuda8和cuda9

    转载自 https blog csdn net lovebyz article details 80704800 为了使用tensorflow目标检测API的所有算法 所以打算升级一下CUDA版本以支持tf gpu 1 5 但原本项目都是基
  • HTML5 canvas标签-1 基本使用

    终于有空使用csdn和大家分享点自己平时学习工作时候的心德啦 第一步 介绍下canvas的基本使用 首先 因为canvas是html5的一个标签 所以保险起见 可以先确认下canvas是否兼容 try document createElem
  • VISIO中的工具栏、菜单栏丢失的原因及解决办法

    症状 在 Microsoft Visio 中 您可能会遇到一个或多个以下症状 您所了解的工具栏是启用是不可见的 找不到菜单栏 按钮从工具栏中消失了
  • k8s搭建部署3个节点服务器

    目录 一 环境准备 二 安装kubeadm kubelet和kubectl 三 部署kubernetes Master 四 node节点加入集群 五 查看集群的状态 Init ImagePullBackOff错误 swap分区没有关闭 没有