zoukankan      html  css  js  c++  java
  • CKA-docker 基础

      CKA + CKAD

    CKA全称为(Certificated Kubernetes Administrator)  Kubernetes管理员。

    CKAD全称为(Certificated Kubernetes Application Developer) Kubernetes应用程序开发人员认证

    # Kubernetes不再支持Docker?!

    Kubernetes 在 v1.20 版本之后将不再使用 Docker 作为容器运行时

    https://kubernetes.io/blog/2020/12/02/dont-panic-kubernetes-and-docker/

    参考链接1

    参考链接2

      容器介绍

    # 虚拟化 和容器化 图示区别(自行收集和补充)

     

    infrastructure  基础设施 

    能够管理容器(创建、删除、停止、启动)叫做runtime

    既可以管理容器也可以管理镜像 叫做高级别runtime

    只能管理容器,叫做低级别runtime(e.g. runc gvisor lxc kata  etc. )

      测试环境准备

    centos7.4

    k8s-tmp 克隆一个镜像 

    内存: 4G

    网络:nat

    子网IP: 192.168.26.x

    用户名: root

    密码: redhat

    主机名: vms61

    hostnamectl set-hostname   vms61

    setterm -blank 0

    set.sh  # 设置ip

    # 下载yum源

    wget  ftp://ftp.rhce.cc/k8s/*

    getenforce  # 确认selinux 

    # 允许所有数据包通过防火墙(不要关闭,仅测试机这样设置,生产环境慎用)

      

    systemctl enable docker --now

    systemctl restart docker

    # 最后查看安装完毕的docker

    docker info 

    docker info
    
    Client:
     Context:    default
     Debug Mode: false
     Plugins:
      app: Docker App (Docker Inc., v0.9.1-beta3)
      buildx: Build with BuildKit (Docker Inc., v0.5.1-docker)
    
    Server:
     Containers: 0
      Running: 0
      Paused: 0
      Stopped: 0
     Images: 2
     Server Version: 20.10.4
     Storage Driver: overlay2
      Backing Filesystem: xfs
      Supports d_type: true
      Native Overlay Diff: true
     Logging Driver: json-file
     Cgroup Driver: cgroupfs
     Cgroup Version: 1
     Plugins:
      Volume: local
      Network: bridge host ipvlan macvlan null overlay
      Log: awslogs fluentd gcplogs gelf journald json-file local logentries splunk syslog
     Swarm: inactive
     Runtimes: io.containerd.runc.v2 io.containerd.runtime.v1.linux runc
     Default Runtime: runc
     Init Binary: docker-init
     containerd version: 269548fa27e0089a8b8278fc4fc781d7f65a939b
     runc version: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
     init version: de40ad0
     Security Options:
      seccomp
       Profile: default
     Kernel Version: 3.10.0-693.el7.x86_64
     Operating System: CentOS Linux 7 (Core)
     OSType: linux
     Architecture: x86_64
     CPUs: 16
     Total Memory: 7.795GiB
     Name: Centos74-maKiS47F
     ID: FBE5:TUMO:NXO4:IYHP:IBHQ:S4CZ:DBYH:MSQH:CM5R:C7LP:AE22:ETAC
     Docker Root Dir: /var/lib/docker
     Debug Mode: false
     Registry: https://index.docker.io/v1/
     Labels:
     Experimental: false
     Insecure Registries:
      127.0.0.0/8
     Registry Mirrors:
      https://1vs5nfat.mirror.aliyuncs.com/
     Live Restore Enabled: false
    View Code

    # 查看Docker当前Runtime,默认调用的runc

      

     # 直接通过runC 如何管理容器的

    参考此文

     Docker 镜像简介

    docker images

    # 镜像从哪里来

    1. 网上拉取

    2. 自己构建

    Docker的官方仓库  docker-hub

    网易镜像仓库  网易仓库

    阿里云镜像仓库 阿里仓库

    # 拉取镜像(国内比较慢,需要配置加速器)

    docker pull nginx 

    docker 加速器

    以阿里云为例:

    控制台-容器镜像服务-镜像加速器

    针对Docker客户端版本大于 1.10.0 的用户
    
    您可以通过修改daemon配置文件/etc/docker/daemon.json来使用加速器
    sudo mkdir -p /etc/docker
    sudo tee /etc/docker/daemon.json <<-'EOF'
    {
      "registry-mirrors": ["https://xxx.mirror.aliyuncs.com"]  # 这里根据自己账号情况修改
    }
    EOF
    sudo systemctl daemon-reload
    sudo systemctl restart docker

    国内仓库

    阿里云-控制台-容器镜像服务-镜像搜索 -公用网络

    # docker pull 公用网络:版本  

    PS:不跟版本默认为latest

      

    # 网易云

    www.163yun.com

    镜像仓库-镜像中心

     

      

    # 显示镜像创建历史

    docker history nginx:latest

    PS:  适用参数  --no-trunc  可以看到更详细内容

    Dockerfile文件 用于 构建,生产镜像  (Docker专属)
    yml格式的文件 基于镜像部署容器(通用格式)

    Nginx目录结构

    web存放目录: /usr/share/nginx/html

    配置文件存放目录:/etc/nginx/nginx.conf 

    Mysql目录结构和基本变量

    db存放目录: /var/lib/mysql

    配置文件存放目录:/etc/mysql/my.cnf

    数据库密码变量: MYSQL_ROOT_PASSWORD=my-secret-pw 

    Apache目录结构

    web存放目录:  /usr/local/apache2/htdocs/

    配置文件存放目录: /usr/local/apache2/conf/httpd.conf

    Tomcat目录结构

    web存放目录:/usr/local/tomcat/webapps

    配置文件存放目录: /usr/local/tomcat/conf/

    redis目录结构

    db存放目录:/data

    配置文件存放目录:/usr/local/etc/redis/redis.conf

  • 相关阅读:
    JavaScript Date对象和函数 (一)
    Css3 文字渐变整理(一)
    Asp.net Core CacheHelper 通用缓存帮助类
    .net core中使用GB2312编码的问题
    苹果手机微信浏览器select标签选择完成之后页面不会自动回到原位
    .Net Core NOPI操作word(二) 表格操作
    .Net Core NOPI操作word(一)
    .NetCore中EFCore的使用整理(三)-关联表操作
    windos server2012安装.net core 2.2问题
    C# 最简单的使程序单进程运行的方法
  • 原文地址:https://www.cnblogs.com/Cong0ks/p/14458170.html
Copyright © 2011-2022 走看看