Container技术峰会-Docker与OpenShift的结合-蔡书.pdf
OpenShift使用容器的好选择 蔡书(caishuredhat.com) 2015-04-18 纲要 OpenShift简介 对比OpenShift v2 & v3 适用场景 快速上手 V3架构 V3概念 RHEL7 & Atomic & 容器 & OpenShift Q&A OpenShift简介 公有云和私有云同一套代码 公有云在Gartner魔力象限排在Salesforce和 微软之后 私有云全球有100+的企业客户。金融、电 信、电商、政府、制造业 两个主要版本V2 & V3 企业级aPaaS魔力象限 优势 OpenShift Online and OpenShift Enterprise use the same codebase, and offer the flexibility and choice to deploy in the public cloud and in the enterprise's data center. Red Hat's financial strength and its expertise in Linux, Java and security make its offerings attractive to enterprises. Although Red Hat had a late start in the aPaaS market, it now has a solid offering, and it is gaining market share. The JBoss software stacks are familiar to many enterprise developers, and the polyglot cartridge model (and future Docker integration) can support any middleware environment. Users cite simplicity and ease of use as two compelling advantages to the platform. OpenShift has good support for DevOps and continuous delivery, as well as autoscaling. Docker support will make it even easier to deploy applications. Red Hat will also adopt Google's Kubernetes for orchestration, which will provide fine- grained control of automation and autoscaling. 注意事项 Red Hat promotes the OpenShift framework as a standard, although, to date, Cloud Foundry has gained wider vendor support as a PaaS framework standard. This has put Red Hat at a disadvantage in its efforts to develop a partner ecosystem, which is illustrated by modest third party participation in the OpenShift Marketplace. In an effort to spur OpenShift adoption, RedHat recently launched the OpenShift Commons Community to foster collaboration and engagement via an open-source community. Docker support will greatly expand the OpenShift ecosystem. The JBoss BPM and BRMS cartridges support model-driven development, although they dont provide the kind of high-productivity advantages typical of a high-productivity aPaaS. OpenShift can support third-party high-productivity cartridges, but the DevOps experience is designed for the professional developer. It offers few GUI interfaces, and developers typically interface with the environment using command line interfaces (CLIs). OpenShift's built-in analytics and operational dashboards are fairly limited. To augment the basic capabilities, the customer must use third-party monitoring cartridges. For example, New Relic and AppDynamics cartridges are available through the OpenShift Marketplace. Users note that, although OpenShift supports autoscaling, it may take a few minutes to spin up a new Gear for large applications. The next release, which includes Docker image-based deployment and Kubernetes orchestration, will improve system resource management and should alleviate this scalability concern. 对比V2 & V3 物理机 物理机/VM V2 Gear (cg+se) 物理机/VM V3 Docker (cg+se+ns, lvm) 物理机 KVM 虚拟化非虚拟化 V2相比于V3更轻量化没有使用NS;没有使用Union FS V2适用于固定模型的应用;V3几乎适用任何模型 V2的依赖是RHEL6操作系统;V3依赖Docker/Kubernetes/Etcd (RHEL7, RHEL7 Atomic提供了底层的Kubernetes+Etcd) V2存在超过3年,具有验证过的可靠性;V3预计2015年中正式发布 容器技术 适用场景 相比较之下,V2更适用以下场景: 要求同时兼容传统的3层结构BS应用和新的无状态应用 更高的性能要求 需要cg就够的场景,运维的好工具 更大的部署规模(active-mq + mcollective + mongodb) 相比较之下,V3更适用以下场景: 面向无状态的应用,使用外部对象存储,使用外部的日志服务 复杂的网络模型 模拟公有云的操作体验 更高频度的容器创建与销毁 微服务 V2的典型使用 NginxNginx GearGearGearGearGearGear 文件系统 SQL& NOSQL 消息队列 Cache 快速上手使用docker 安装RHEL7 Atomic docker run -d -name “openshift-origin“ - net=host privileged -v /var/run/docker.sock:/var/run/docker.sock -v /tmp/openshift:/tmp/openshift openshift/origin start Docker exec it openshift-origin bash Openshift ex new-project myproj admin=myuser https:/xxx.xxx.xxx.xxx:8443/ 快速上手不使用docker 安装RHEL7 下载 https:/github.com/openshift/origin/releases 解压缩,执行openshift start Openshift ex new-project myproj admin=myuser https:/xxx.xxx.xxx.xxx:8443/ 快速上手编译源代码 安装RHEL7 subscription-manager repos -enable rhel-7-server- extras-rpms -enable rhel-7-server-optional-rpms yum install -y golang git golang-vim make export GOPATH=$HOME/go export PATH=$PATH:$GOPATH/bin go get github.com/openshift/origin cd $GOPATH/src/github.com/openshift/origin hack/build-go.sh _output/local/go/bin/openshift start V3架构概述 概念 Container, docker, base image, Image, cgroup, namespace, selinux, cow, nat Kubernetes (k8s), etcd, master, node(Minion), pod, controller manager, API server, scheduler, kubelet, proxy, replication controller, label, name space, limitRange, resourceQuota, resource Build, build config, build strategy, build log, deployment, deployment config, image, image repository, template, route, project, user, user identity mapping, oauth client RHEL7 & Atomic devops 集群 容器 RHEL7, Atomic, 容器, OpenShift Q&A