先基于外部镜像构建一个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后访问成功。

Openshift中Configmap的使用的更多相关文章

  1. OpenShift中的持续交付

    上一文中讲述了如何在AWS下搭建OpenShift集群.这篇文章将目光转向如何在OpenShift中实现CI/CD以及产品环境的部署. 持续交付 如果要打造一个持续交付的流水线,首先要考虑多环境的问题 ...

  2. Openshift中Pod的SpringBoot2健康检查

    Openshift中Pod的SpringBoot2应用程序健康检查 1. 准备测试的SpringBoot工程, 需要Java 8 JDK or greater and Maven 3.3.x or g ...

  3. k8s中configmap的使用方法

      ConfigMaps允许您将配置构件与映像内容解耦,以保持容器化应用程序的可移植性.本文展示如何创建configmap,修改configmap以及如何把configmap应用于pod. 创建con ...

  4. 在AWS中部署OpenShift平台

    OpenShift是RedHat出品的PAAS平台.OpenShift做为PAAS平台最大的特点是它是完全容器化的PAAS平台,底层封装了Docker和Kubernetes,上层暴露了对开发者友好的接 ...

  5. openshift 4.3中安装helm3并通过helm方式部署应用

    openshift 4.3中安装helm3并通过helm方式部署应用 简介 Helm是一个命令行界面(CLI)工具,可简化将应用程序和服务部署到OpenShift Container Platform ...

  6. Openshift初步学习问题集

    1.设置资源限额 详细参考 https://docs.openshift.com/enterprise/3.2/admin_guide/quota.html#sample-resource-quota ...

  7. 005.OpenShift访问控制-权限-角色

    一 Kubetcl namespace 1.1 namespace描述 Kubernetes namespace提供了将一组相关资源组合在一起的机制.在Red Hat OpenShift容器平台中,p ...

  8. 使用Navicat远程管理OpenShift的数据库

    其实 phpMyAdmin 这个 web 端的 MySQL 数据库管理工具还是很好的,要不然也不会成为 MySQL 数据库的绝配.但是我想,很多人应该和重华一样,不太喜欢使用 web 端的工具,总觉得 ...

  9. openshift django目录结果

    blog├── README.md├── requirements.txt├── setup.py├── static├── wsgi│   ├── application│   ├── db.sql ...

随机推荐

  1. 刷题中熟悉Shell命令之Tenth Line和Transpose File [leetcode]

    首先介绍题目中要用的4个Shell命令 sed awk head tail的常用方法.(打好地基,才能建成高楼!) sed:(转自:http://www.cnblogs.com/barrychiao/ ...

  2. AC日记——「SCOI2016」幸运数字 LiBreOJ 2013

    「SCOI2016」幸运数字 思路: 线性基: 代码: #include <bits/stdc++.h> using namespace std; #define maxn 20005 # ...

  3. bzoj 1449 费用流

    思路:先把没有进行的场次规定双方都为负,对于x胜y负 变为x + 1胜 y - 1 负所需要的代价为 2 * C[ i ] * x  - 2 * D[ i ] * y + C[ i ] + D[ i ...

  4. 微软企业库5.0 学习之路——第八步、使用Configuration Setting模块等多种方式分类管理企业库配置信息

    在介绍完企业库几个常用模块后,我今天要对企业库的配置文件进行处理,缘由是我打开web.config想进行一些配置的时候发现web.config已经变的异常的臃肿(大量的企业库配置信息充斥其中),所以决 ...

  5. php api接口校验规则示例

    1.发送 /** * 客户端请求 * @param url 接口地址 * @param array $params(post) * @return json * @throws Exception * ...

  6. sql 触发器 游标

    在数据库中,删除一条记录的同时想要删除另一个表里的数据,这时我们可以选择使用触发器.触发器主要是通过事件进行触发被自动调用执行的,而存储过程可以通过存储过程的名称被调用.触发器是当对某一个表进行操作. ...

  7. Codeforces Round #113 (Div. 2) Tetrahedron(滚动DP)

    Tetrahedron time limit per test 2 seconds memory limit per test 256 megabytes input standard input o ...

  8. CentOS中Ctrl+Z、Ctrl+C、Ctrl+D的区别

    Ctrl+C和Ctrl+Z都是中断命令,但作用不同. Ctrl+C是发送SIGINT信号,终止一个进程. Ctrl+Z是发送SIGSTOP信号,挂起一个进程,将作业放置到后台(暂停状态).与此同时,可 ...

  9. Envious Exponents

    问题 E: Envious Exponents 时间限制: 1 Sec  内存限制: 128 MB提交: 321  解决: 53[提交] [状态] [讨论版] [命题人:] 题目描述 Alice an ...

  10. 设计模式-状态模式(State Pattern)

    本文由@呆代待殆原创,转载请注明出处:http://www.cnblogs.com/coffeeSS/ 状态模式简介 状态模式允许一个对象在其内部状态改变的时候改变它的行为,他的内部会存着好几种状态, ...