先基于外部镜像构建一个deployment

ericdeMacBook-Pro:nginx ericnie$ oc new-app ericnie2017/nginx:v1. --allow-missing-images --name=nginx-demo -n myproject
--> Found Docker image 48a076d ( minutes old) from Docker Hub for "ericnie2017/nginx:v1.0" * An image stream will be created as "nginx-demo:v1.0" that will track this image
* This image will be deployed in deployment config "nginx-demo"
* Ports /tcp, /tcp will be load balanced by service "nginx-demo"
* Other containers can access this service through the hostname "nginx-demo"
* WARNING: Image "ericnie2017/nginx:v1.0" runs as the 'root' user which may not be permitted by your cluster administrator --> Creating resources ...
imagestream "nginx-demo" created
deploymentconfig "nginx-demo" created
service "nginx-demo" created
--> Success
Application is not exposed. You can expose services to the outside world by executing one or more of the commands below:
'oc expose svc/nginx-demo'
Run 'oc status' to view your app.

生成Route

ericdeMacBook-Pro:nginx ericnie$ oc expose svc nginx-demo --hostname=nginx-demo-myproject.192.168.99.100.nip.io
route "nginx-demo" exposed

访问8080端口成功。

查看镜像中的nginx.conf,发现最后配置是调用的config.d下的应用配置文件

$ cat nginx.conf

user  nginx;
worker_processes ; error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid; events {
worker_connections ;
} http {
include /etc/nginx/mime.types;
default_type application/octet-stream; log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"'; access_log /var/log/nginx/access.log main; sendfile on;
#tcp_nopush on; keepalive_timeout ; #gzip on; include /etc/nginx/conf.d/*.conf;
}

然后建立一个nginx.conf文件,将8080端口修改为8011

ericdeMacBook-Pro:nginx ericnie$ cat nginx.conf
server{
listen ;
server_name _;
location /{
root /usr/share/nginx/html;
index index.html index.htm;
}
error_page /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

生成一个configmap

ericdeMacBook-Pro:nginx ericnie$ oc create configmap nginx-conf --from-file=nginx.conf
configmap "nginx-conf" created

在OKD的resource的configmap下看到

查看目前的pod配置文件目录

切换回configmap,然后选择Add to Application

保存后openshift会构建新的实例,原有应用访问失败

修改Service后访问成功。

最新文章

  1. Apache多端口监听
  2. 在Eclipse里查看Java字节码
  3. [安卓] 4、CheckBox、RadioButton和Toast简单用法
  4. CocoStudio教程三:认识并利用CocoStudio的果实 运行2.2.1版本
  5. 字符截取 支持UTF8/GBK
  6. resin的简单介绍和使用
  7. SQL Server 2005下载安装
  8. C++学习(五)
  9. API例子:用Python驱动Firefox采集网页数据
  10. js复制button在ie下的解决方式
  11. [转]iOS hacking resource collection
  12. 蓝牙协议 基于TI cc2540 模块的理解(转)
  13. jQuery插件开发详解
  14. ●BZOJ 3551 [ONTAK2010]Peaks(在线)
  15. Linux内存管理 (8)malloc
  16. Android快速实现二维码扫描--Zxing
  17. Sprint冲刺第二阶段之6---10天(下)
  18. spoj gss1 gss3
  19. MapGIS Mobile开发
  20. Hdu1548 A strange lift 2017-01-17 10:34 35人阅读 评论(0) 收藏

热门文章

  1. mac系统命令行获取root权限
  2. Linux之父Linus的8个趣闻轶事
  3. Linux的文件帮助和运行级别
  4. ubuntu 安装mysql及目录位置
  5. centos xampp 隐藏phpmyadmin地址
  6. python的递归函数
  7. hibernate自连接--典型的oracle自带emp实现
  8. 洛谷——P3909 异或之积
  9. DBCS 从256开始
  10. oracle return code 2112