doudoutj

对象式编程语言:

  • 以数据为中心,代码服务于数据

    • 数据:对象

    • 代码:方法

  • class:类

    • 属性,方法

K8S api: REST API(http/https)

  • resource -> object

  • method: GET ,PUT ,POST, DELETE, PATCH...

k8s:cluster,容器编排系统

  • 核心任务:容器编排

  • 容器:应用程序

  • Pod Controller, Deployment

Kubernetes Network

image-20210604153406916

部署要点

  • 测试环境

    • 可以使用单Master节点,单etcd实例;

    • Node主机数量按需而定

    • nfs或glusterfs等存储系统;

  • 生产环境

    • 高可用etcd集群,建立3、5或7个节点

    • 高可用Master

      • kube-apiserver无状态,可多实例

        • 借助于keepalive进行vip流动实现多实例冗余;

        • 或在多实例前端通过HAProxy或Nginx反代,并借助keepalive对代理服务器进行冗余;

      • kube-scheduler 及kube-controller-manager各自只能有一个活动实例,但可以有多个备用;

        • 各自自带leader选举的功能,并且默认处于启用状态;

    • 多Node主机,数量越多,冗余能力越强;

    • ceph, glusterfs, iSCSI, FC SAN及各种云存储等;

部署工具

  • 常用的部署环境

    • IaaS公有云环境:AWS, GCE, Azure等

    • IaaS私有云或公有云环境:OpenStack和vSphere等;

    • Baremetal环境:物理服务器或独立的虚拟机等;

  • 常用的部署工具

    • kubeadm

    • kops

    • kubespray

    • Kontena Pharos

    • ...

  • 其他二次封装的常用发行版

    • Rancher

    • Tectonic

    • Openshift

    • ...

  • Master , Node

  • Client -> Master(API Server)

  • Registry:Docker Hub, gcr.io, quay.io

image-20210604162450550

 

image-20210604184820588

 

image-20210604184915406

 

image-20210604202043118

 

 [root@iZ2vcdx512qke62ysebmttZ ~]# systemctl status chronyed
 Unit chronyed.service could not be found.
 [root@iZ2vcdx512qke62ysebmttZ ~]# date
 Fri Jun  4 16:46:30 CST 2021
 [root@iZ2vcdx512qke62ysebmttZ ~]# clear
 [root@iZ2vcdx512qke62ysebmttZ ~]# systemctl stop firewalld
 [root@iZ2vcdx512qke62ysebmttZ ~]# systemctl disable firewalld
 [root@iZ2vcdx512qke62ysebmttZ ~]# sed -i \'s/enforcing/disabled/\' /etc/selinux/config
 [root@iZ2vcdx512qke62ysebmttZ ~]# setenforce 0
 setenforce: SELinux is disabled
 [root@iZ2vcdx512qke62ysebmttZ ~]# swapoff -a
 [root@iZ2vcdx512qke62ysebmttZ ~]# sed -ri \'s/.*swap.*/#&/\' /etc/fstab
 [root@iZ2vcdx512qke62ysebmttZ ~]# hostnamectl set-hostname
 Invalid number of arguments.
 [root@iZ2vcdx512qke62ysebmttZ ~]# hostnamectl set-hostname master
 [root@iZ2vcdx512qke62ysebmttZ ~]# cat >> /etc/hosts << EOF
 > 47.109.19.74 master
 > 47.109.21.242 node01
 > 47.109.21.247 node02
 > 47.109.23.91 node03
 > EOF
 [root@iZ2vcdx512qke62ysebmttZ ~]# cat > /etc/sysctl.d/k8s.conf << EOF
 > net.bridge.bridge-nf-call-ip6tables = 1
 > net.bridge.bridge-nf-call-iptables = 1
 > EOF
 [root@iZ2vcdx512qke62ysebmttZ ~]# sysctl --system
 * Applying /usr/lib/sysctl.d/00-system.conf ...
 * Applying /usr/lib/sysctl.d/10-default-yama-scope.conf ...
 kernel.yama.ptrace_scope = 0
 * Applying /usr/lib/sysctl.d/50-default.conf ...
 kernel.sysrq = 16
 kernel.core_uses_pid = 1
 net.ipv4.conf.default.rp_filter = 1
 net.ipv4.conf.all.rp_filter = 1
 net.ipv4.conf.default.accept_source_route = 0
 net.ipv4.conf.all.accept_source_route = 0
 net.ipv4.conf.default.promote_secondaries = 1
 net.ipv4.conf.all.promote_secondaries = 1
 fs.protected_hardlinks = 1
 fs.protected_symlinks = 1
 * Applying /etc/sysctl.d/99-sysctl.conf ...
 vm.swappiness = 0
 kernel.sysrq = 1
 net.ipv4.neigh.default.gc_stale_time = 120
 net.ipv4.conf.all.rp_filter = 0
 net.ipv4.conf.default.rp_filter = 0
 net.ipv4.conf.default.arp_announce = 2
 net.ipv4.conf.lo.arp_announce = 2
 net.ipv4.conf.all.arp_announce = 2
 net.ipv4.tcp_max_tw_buckets = 5000
 net.ipv4.tcp_syncookies = 1
 net.ipv4.tcp_max_syn_backlog = 1024
 net.ipv4.tcp_synack_retries = 2
 * Applying /etc/sysctl.d/k8s.conf ...
 * Applying /etc/sysctl.conf ...
 vm.swappiness = 0
 kernel.sysrq = 1
 net.ipv4.neigh.default.gc_stale_time = 120
 net.ipv4.conf.all.rp_filter = 0
 net.ipv4.conf.default.rp_filter = 0
 net.ipv4.conf.default.arp_announce = 2
 net.ipv4.conf.lo.arp_announce = 2
 net.ipv4.conf.all.arp_announce = 2
 net.ipv4.tcp_max_tw_buckets = 5000
 net.ipv4.tcp_syncookies = 1
 net.ipv4.tcp_max_syn_backlog = 1024
 net.ipv4.tcp_synack_retries = 2
 [root@iZ2vcdx512qke62ysebmttZ ~]# yum install ntpdate -y
 Loaded plugins: fastestmirror
 Determining fastest mirrors
 base                                                                                                                                                         | 3.6 kB  00:00:00    
 epel                                                                                                                                                         | 4.7 kB  00:00:00    
 extras                                                                                                                                                       | 2.9 kB  00:00:00    
 updates                                                                                                                                                     | 2.9 kB  00:00:00    
 (1/7): epel/x86_64/group_gz                                                                                                                                 |  96 kB  00:00:00    
 (2/7): base/7/x86_64/group_gz                                                                                                                               | 153 kB  00:00:00    
 (3/7): epel/x86_64/updateinfo                                                                                                                               | 1.0 MB  00:00:00    
 (4/7): extras/7/x86_64/primary_db                                                                                                                           | 236 kB  00:00:00    
 (5/7): epel/x86_64/primary_db                                                                                                                               | 6.9 MB  00:00:00    
 (6/7): updates/7/x86_64/primary_db                                                                                                                           | 8.0 MB  00:00:00    
 (7/7): base/7/x86_64/primary_db                                                                                                                             | 6.1 MB  00:00:00    
 Resolving Dependencies
 --> Running transaction check
 ---> Package ntpdate.x86_64 0:4.2.6p5-29.el7.centos.2 will be installed
 --> Finished Dependency Resolution
 
 Dependencies Resolved
 
 ====================================================================================================================================================================================
  Package                                 Arch                                   Version                                                 Repository                           Size
 ====================================================================================================================================================================================
 Installing:
  ntpdate                                 x86_64                                 4.2.6p5-29.el7.centos.2                                 base                                  87 k
 
 Transaction Summary
 ====================================================================================================================================================================================
 Install  1 Package
 
 Total download size: 87 k
 Installed size: 121 k
 Downloading packages:
 ntpdate-4.2.6p5-29.el7.centos.2.x86_64.rpm                                                                                                                   |  87 kB  00:00:00    
 Running transaction check
 Running transaction test
 Transaction test succeeded
 Running transaction
 Warning: RPMDB altered outside of yum.
  Installing : ntpdate-4.2.6p5-29.el7.centos.2.x86_64                                                                                                                           1/1
  Verifying : ntpdate-4.2.6p5-29.el7.centos.2.x86_64                                                                                                                           1/1
 

分类:

技术点:

相关文章:

  • 2021-10-19
  • 2021-02-27
  • 2021-10-19
  • 2021-10-19
  • 2021-10-19
  • 2021-10-19
  • 2019-11-18
  • 2021-09-19
猜你喜欢
  • 2021-10-19
  • 2021-09-19
  • 2021-09-19
  • 2021-10-19
  • 2021-09-19
  • 2021-10-19
  • 2021-11-07
相关资源
相似解决方案