精华内容
下载资源
问答
  • 二进制安装K8S.zip

    2020-03-31 23:16:57
    二进制安装K8S高可用问题,md格式源码!!! 记录了整个安装过程 在线文档链接:https://blog.csdn.net/isa_II/article/details/105234956
  • 二进制安装k8s-1.15.2

    2020-12-04 17:06:50
    详细介绍如何使用二进制安装k8s-1.15.2,具体包括如下内容 实验环境服务器准备 安装前准备 安装部署主控节点服务-etcd 安装部署运算节点服务-kubelet 安装部署核心插件flannel 6. K8S集群的平滑集群技巧
  • 二进制安装k8s - 0.5 二进制安装Docker 这里装的版本为: docker-18.09.8 、 19.X不通用 安装docker 准备docker相关目录 [root@master data]# mkdir -p /data/docker/bin 复制 docker 二进制文件 cd /data/k8s/...

    二进制安装k8s - 0.5 二进制安装Docker

    这里装的版本为: docker-18.09.8 、 19.X不通用

    这里可以只装node节点机器 master不参与服务启动。




    安装docker

    准备docker相关目录

    [root@master data]# mkdir -p /data/docker/{bin,data}
    

    下载 docker 二进制文件

    wget https://download.docker.com/linux/static/stable/x86_64/docker-18.09.8.tgz
    tar zxf docker-18.09.8.tgz
    mv docker/* /data/docker/bin/
    
    ls /data/docker/bin/
    containerd  containerd-shim  ctr  docker  dockerd  docker-init  docker-proxy  runc
    

    注: 命令补全 /etc/bash_completion.d/docker 文件自行百度。

    docker国内镜像加速 & docker 工作目录修改

    mkdir -p /etc/docker
    vim /etc/docker/daemon.json

    {
      "registry-mirrors": ["https://docker.mirrors.ustc.edu.cn", "http://hub-mirror.c.163.com"], 
      "max-concurrent-downloads": 10,
      "log-driver": "json-file",
      "log-level": "warn",
      "log-opts": {
        "max-size": "10m",
        "max-file": "3"
        },
      "data-root": "/data/docker/data"
    }
    

    创建docker的 systemd 文件

    vim /etc/systemd/system/docker.service

    [Unit]
    Description=Docker Application Container Engine
    Documentation=http://docs.docker.io
    
    [Service]
    Environment="PATH=/data/docker/bin:/bin:/sbin:/usr/bin:/usr/sbin"
    ExecStart=/data/docker/bin/dockerd 
    ExecStartPost=/sbin/iptables -I FORWARD -s 0.0.0.0/0 -j ACCEPT
    ExecReload=/bin/kill -s HUP $MAINPID
    Restart=always
    RestartSec=5
    LimitNOFILE=infinity
    LimitNPROC=infinity
    LimitCORE=infinity
    Delegate=yes
    KillMode=process
    
    [Install]
    WantedBy=multi-user.target
    

    启用docker 服务 & 创建执行命令

    systemctl daemon-reload
    systemctl restart docker
    systemctl status docker
    
    ln -s /data/docker/bin/docker /usr/sbin/docker
    




    展开全文
  • 文章目录1. 创建配置文件2. systemd管理scheduler3. 启动并设置开机启动4. 查看集群状态 注意: 阅读本文前,请...二进制方式安装k8s-部署kube-controller-manager 这篇文章开始,我们要部署scheduler 1. 创建配置文件


    注意: 阅读本文前,请确保已经看过以下文章:

    1. 学习k8s必看:在下载相关资源的时候出现无法解析到主机地址的情况
    2. 二进制方式搭建kubernetes集群搭建步骤
    3. 二进制安装k8s-部署etcd集群
    4. 二进制方式搭建kubernetes集群-部署master组件
    5. 二进制方式安装k8s-部署kube-controller-manager

    这篇文章开始,我们要部署scheduler

    1. 创建配置文件

    cat > /opt/kubernetes/cfg/kube-scheduler.conf << EOF
    KUBE_SCHEDULER_OPTS="--logtostderr=false \
    --v=2 \
    --log-dir=/opt/kubernetes/logs \
    --leader-elect \
    --master=127.0.0.1:8080 \
    --bind-address=127.0.0.1"
    EOF
    

    –master:通过本地非安全本地端口8080连接apiserver。
    –leader-elect:当该组件启动多个时,自动选举(HA)

    2. systemd管理scheduler

    cat > /usr/lib/systemd/system/kube-scheduler.service << EOF
    [Unit]
    Description=Kubernetes Scheduler
    Documentation=https://github.com/kubernetes/kubernetes
    
    [Service]
    EnvironmentFile=/opt/kubernetes/cfg/kube-scheduler.conf
    ExecStart=/opt/kubernetes/bin/kube-scheduler \$KUBE_SCHEDULER_OPTS
    Restart=on-failure
    
    [Install]
    WantedBy=multi-user.target
    EOF
    

    3. 启动并设置开机启动

    systemctl daemon-reload
    systemctl start kube-scheduler
    systemctl enable kube-scheduler
    

    4. 查看集群状态

    所有组件都已经启动成功,通过kubectl工具查看当前集群组件状态:
    kubectl get cs

    [root@oldxin-master17 ~]# kubectl get cs
    Warning: v1 ComponentStatus is deprecated in v1.19+
    NAME                 STATUS    MESSAGE             ERROR
    controller-manager   Healthy   ok                  
    scheduler            Healthy   ok                  
    etcd-1               Healthy   {"health":"true"}   
    etcd-0               Healthy   {"health":"true"} 
    

    OK, 接下来我们要开始安装node了

    展开全文
  • 二进制安装k8s - 0.8 master安装 kube-scheduler

    二进制安装k8s - 0.8 安装 flannel 网络插件

    这里直接用pod方式启动flannel插件

    node节点操作

    解压cni插件二进制文件

    wget https://github.com/containernetworking/plugins/releases/download/v0.8.5/cni-plugins-linux-amd64-v0.8.5.tgz
    
    tar zxf cni-plugins-linux-amd64-v0.8.5.tgz -C /data/k8s/bin/
    

    取消原cni配置,改为flannle、cni配置

    cd /data/k8s/cni/net.d/
    
    mv 10-default.conf 10-default.conf.bak
    

    vim /data/k8s/cni/net.d/10-flannel.conflist

    {
      "name": "cbr0",
      "plugins": [
        {
          "type": "flannel",
          "delegate": {
            "hairpinMode": true,
            "isDefaultGateway": true
          }
        },
        {
          "type": "portmap",
          "capabilities": {
            "portMappings": true
          }
        }
      ]
    }
    


    master上操作

    创建 flannel DaemonSet yaml文件

    ---
    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
      runAsUser:
        rule: RunAsAny
      supplementalGroups:
        rule: RunAsAny
      fsGroup:
        rule: RunAsAny
      allowPrivilegeEscalation: false
      defaultAllowPrivilegeEscalation: false
      allowedCapabilities: ['NET_ADMIN']
      defaultAddCapabilities: []
      requiredDropCapabilities: []
      hostPID: false
      hostIPC: false
      hostNetwork: true
      hostPorts:
      - min: 0
        max: 65535
      seLinux:
        rule: 'RunAsAny'
    ---
    kind: ClusterRole
    apiVersion: rbac.authorization.k8s.io/v1beta1
    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/v1beta1
    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-amd64
      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: beta.kubernetes.io/os
                        operator: In
                        values:
                          - linux
                      - key: beta.kubernetes.io/arch
                        operator: In
                        values:
                          - amd64
          hostNetwork: true
          tolerations:
          - operator: Exists
            effect: NoSchedule
          serviceAccountName: flannel
          initContainers:
          - name: install-cni
            image: quay.io/coreos/flannel:v0.11.0-amd64
            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.11.0-amd64
            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"]
            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
    

    执行yaml创建flannel

    kubectl apply -f flannel.yaml
    

    查看pod启动情况

    [root@master ~]# kubectl get pod -A
    NAMESPACE     NAME                          READY   STATUS    RESTARTS   AGE
    kube-system   kube-flannel-ds-amd64-hpvf8   1/1     Running   1          2d11h
    


    节点IP查看

    [root@node01 net.d]# ifconfig
    cni0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1450
            inet 10.244.0.1  netmask 255.255.255.0  broadcast 10.244.0.255
            ether 96:90:03:a0:5a:ee  txqueuelen 1000  (Ethernet)
            RX packets 83857  bytes 5729371 (5.4 MiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 87296  bytes 34702949 (33.0 MiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
            inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
            ether 02:42:03:fc:41:8a  txqueuelen 0  (Ethernet)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 192.168.100.60  netmask 255.255.255.0  broadcast 192.168.100.255
            ether 00:50:56:81:45:35  txqueuelen 1000  (Ethernet)
            RX packets 615161  bytes 135427132 (129.1 MiB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 139432  bytes 12749467 (12.1 MiB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    flannel.1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1450
            inet 10.244.0.0  netmask 255.255.255.255  broadcast 0.0.0.0
            ether 66:80:da:dd:12:f2  txqueuelen 0  (Ethernet)
            RX packets 0  bytes 0 (0.0 B)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 0  bytes 0 (0.0 B)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    展开全文
  • 二进制安装k8s - 02. 二进制文件下载及生成证书 二进制文件下载 ----download k8s binary at: https://dl.k8s.io/v1.15.6/kubernetes-server-linux-amd64.tar.gz ----download etcd binary at: ...
  • 二进制安装K8S - NODE 节点的安装 安装系统 Linux node02 3.10.0-1062.el7.x86_64 #1 SMP Wed Aug 7 18:08:02 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux 配置系统 关闭 防火墙 systemctl stop firewalld systemctl ...
  • 二进制安装k8s - 0. ETCD 单节点安装 创建目录 & 拷贝文件 [root@master ~]# mkdir -p /data/etcd/{bin,ssl} [root@master ~]# cp /data/k8s/bin/etcd* /data/etcd/bin/ 创建etcd证书请求 创建证书文件...
  • 二进制安装k8s - 0.7 master安装 kube-controller-manager
  • 二进制安装k8s - 0.9 安装 coredns && metrics 这里全部是用yaml 安装。 coredns apiVersion: v1 kind: ServiceAccount metadata: name: coredns namespace: kube-system --- apiVersion: rbac....
  • 二进制安装k8s - 01. 服务器初始化 实验环境 这里最简单化。 一个master 一个node 一个etcd 无高可用 本次所有安装目录都在 /data 下面 192.168.100.59 master etcd 192.168.100.60 node 最小化安装Centos7 直接...
  • 二进制安装k8s - 0.6 master安装 kube-apiserver
  • 二进制安装k8s - 03. 生成所有服务的kubeconfig文件 准备 kubectl 使用的admin证书签名请求 创建配置文件 [root@master cert]# pwd /data/k8s/cert [root@master cert]# vim admin-csr.json { "CN": "admin", ...
  • 创建工作目录并拷贝二进制文件2. 部署kublete2.1 创建配置文件2.2 配置参数文件2.3 生成bootstrap.kubeconfig文件2.4 systemd 管理文件路径2.5 启动并设置开机启动3. 部署kube-proxy3.1 创建配置文件3.2 配置参数...
  • 二进制安装k8s过程中使用以下命令查看组件状态时 kubectl get cs 产生了以下报错 Unable to connect to the server: x509: certificate signed by unknown authority 原因分析: 原因是因为之前在主机中使用...
  • [root@zzgw7-21 ~]# ln -s /opt/kubernetes/server/bin/kubectl /usr/bin/kubectl # 查看状态 [root@zzgw7-21 ~]# kubectl get cs NAME STATUS MESSAGE ERROR scheduler Healthy ok controller-manager Healthy ok...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 15,038
精华内容 6,015
关键字:

二进制安装k8s