openshift-origin-server搭建并部署容器应用
准备主机、操作系统、配置操作系统、主机映射等OpenShift平台使用的容器引擎为Docker,安装Docker软件启动服务,并设置为开机自启动[root@node01 ~]# systemctl start docker[root@node01 ~]# systemctl enable dockerCreated symlink from /etc/systemd/system/mul...
·
准备主机、操作系统、配置操作系统、主机映射等
OpenShift平台使用的容器引擎为Docker,安装Docker软件
启动服务,并设置为开机自启动
[root@node01 ~]# systemctl start docker
[root@node01 ~]# systemctl enable docker
Created symlink from /etc/systemd/system/multi-user.target.wants/docker.service to /usr/lib/systemd/system/docker.service.
运行一个DockerHub的镜像,启动一个go语言的小程序监听8080及8088端口
[root@node01 ~]# docker run -it openshift/hello-openshift
Unable to find image 'openshift/hello-openshift:latest' locally
latest: Pulling from openshift/hello-openshift
4f4fb700ef54: Pull complete
8b32988996c5: Pull complete
Digest: sha256:aaea76ff622d2f8bcb32e538e7b3cd0ef6d291953f3e7c9f556c1ba5baf47e2e
Status: Downloaded newer image for openshift/hello-openshift:latest
serving on 8888
serving on 8080
下载openshift-origin-server-v1.5.1-7b451fc-linux-64bit.tar.gz,解压后重命名
[root@node01 app]# tar -zxvf /app/install/openshift-origin-server-v1.5.1-7b451fc-linux-64bit.tar.gz
tar: Ignoring unknown extended header keyword `LIBARCHIVE.xattr.security.selinux'
openshift-origin-server-v1.5.1-7b451fc-linux-64bit/LICENSE
tar: Ignoring unknown extended header keyword `LIBARCHIVE.xattr.security.selinux'
openshift-origin-server-v1.5.1-7b451fc-linux-64bit/README.md
tar: Ignoring unknown extended header keyword `LIBARCHIVE.xattr.security.selinux'
openshift-origin-server-v1.5.1-7b451fc-linux-64bit/kube-apiserver
tar: Ignoring unknown extended header keyword `LIBARCHIVE.xattr.security.selinux'
openshift-origin-server-v1.5.1-7b451fc-linux-64bit/kube-controller-manager
tar: Ignoring unknown extended header keyword `LIBARCHIVE.xattr.security.selinux'
openshift-origin-server-v1.5.1-7b451fc-linux-64bit/kube-proxy
tar: Ignoring unknown extended header keyword `LIBARCHIVE.xattr.security.selinux'
openshift-origin-server-v1.5.1-7b451fc-linux-64bit/kube-scheduler
tar: Ignoring unknown extended header keyword `LIBARCHIVE.xattr.security.selinux'
openshift-origin-server-v1.5.1-7b451fc-linux-64bit/kubectl
tar: Ignoring unknown extended header keyword `LIBARCHIVE.xattr.security.selinux'
openshift-origin-server-v1.5.1-7b451fc-linux-64bit/kubelet
tar: Ignoring unknown extended header keyword `LIBARCHIVE.xattr.security.selinux'
openshift-origin-server-v1.5.1-7b451fc-linux-64bit/oadm
tar: Ignoring unknown extended header keyword `LIBARCHIVE.xattr.security.selinux'
openshift-origin-server-v1.5.1-7b451fc-linux-64bit/oc
tar: Ignoring unknown extended header keyword `LIBARCHIVE.xattr.security.selinux'
openshift-origin-server-v1.5.1-7b451fc-linux-64bit/openshift
将OpenShift相关命令加入PATH,/etc/profile中添加,也可在bash_profile中添加
[root@node01 app]# vim ~/.bash_profile
# .bash_profile
# Get the aliases and functions
if [ -f ~/.bashrc ]; then
. ~/.bashrc
fi
# User specific environment and startup programs
export OPENSHIFT_HOME=/app/openshift
PATH=$PATH:$HOME/bin:OPENSHIFT_HOME/
export PATH
执行source使配置生效。
[root@node01 app]# source ~/.bash_profile
执行openshift version 查看当前版本,测试是否成功。
[root@node01 app]# openshift version
openshift v1.5.1+7b451fc
kubernetes v1.5.2+43a9be4
etcd 3.1.0
进入/app/openshift目录,执行openshift start命令启动OpenShift Origin。
[root@node01 openshift]# openshift start
W0617 21:03:40.902770 8368 start_master.go:291] Warning: assetConfig.loggingPublicURL: Invalid value: "": required to view aggregated container logs in the console, master start will continue.
W0617 21:03:40.902961 8368 start_master.go:291] Warning: assetConfig.metricsPublicURL: Invalid value: "": required to view cluster metrics in the console, master start will continue.
W0617 21:03:40.902973 8368 start_master.go:291] Warning: auditConfig.auditFilePath: Required value: audit can now be logged to a separate file, master start will continue.
I0617 21:03:40.922358 8368 logs.go:41] warning: ignoring ServerName for user-provided CA for backwards compatibility is deprecated
I0617 21:03:40.926928 8368 logs.go:41] warning: ignoring ServerName for user-provided CA for backwards compatibility is deprecated
I0617 21:03:40.929840 8368 logs.go:41] warning: ignoring ServerName for user-provided CA for backwards compatibility is deprecated
I0617 21:03:40.933368 8368 logs.go:41] warning: ignoring ServerName for user-provided CA for backwards compatibility is deprecated
I0617 21:03:40.937370 8368 logs.go:41] warning: ignoring ServerName for user-provided CA for backwards compatibility is deprecated
......
使用 https 访问本机 IP 的 8443 端口,由于是自签名证书所以浏览器会提示要手动确认和接受证书
使用dev/dev来登录控制台
创建helloworld项目
部署完成项目主页
此处可见已有一个在运行中的实例,查看容器实例的ip,访问helloworld项目。
[root@node01 ~]# curl 172.17.0.3:8080
Hello OpenShift!
至此第一个容器应用部署完成。
更多推荐
已为社区贡献2条内容
所有评论(0)