Openshift中Configmap的使用
先基于外部镜像构建一个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的使用的更多相关文章
- OpenShift中的持续交付
上一文中讲述了如何在AWS下搭建OpenShift集群.这篇文章将目光转向如何在OpenShift中实现CI/CD以及产品环境的部署. 持续交付 如果要打造一个持续交付的流水线,首先要考虑多环境的问题 ...
- Openshift中Pod的SpringBoot2健康检查
Openshift中Pod的SpringBoot2应用程序健康检查 1. 准备测试的SpringBoot工程, 需要Java 8 JDK or greater and Maven 3.3.x or g ...
- k8s中configmap的使用方法
ConfigMaps允许您将配置构件与映像内容解耦,以保持容器化应用程序的可移植性.本文展示如何创建configmap,修改configmap以及如何把configmap应用于pod. 创建con ...
- 在AWS中部署OpenShift平台
OpenShift是RedHat出品的PAAS平台.OpenShift做为PAAS平台最大的特点是它是完全容器化的PAAS平台,底层封装了Docker和Kubernetes,上层暴露了对开发者友好的接 ...
- openshift 4.3中安装helm3并通过helm方式部署应用
openshift 4.3中安装helm3并通过helm方式部署应用 简介 Helm是一个命令行界面(CLI)工具,可简化将应用程序和服务部署到OpenShift Container Platform ...
- Openshift初步学习问题集
1.设置资源限额 详细参考 https://docs.openshift.com/enterprise/3.2/admin_guide/quota.html#sample-resource-quota ...
- 005.OpenShift访问控制-权限-角色
一 Kubetcl namespace 1.1 namespace描述 Kubernetes namespace提供了将一组相关资源组合在一起的机制.在Red Hat OpenShift容器平台中,p ...
- 使用Navicat远程管理OpenShift的数据库
其实 phpMyAdmin 这个 web 端的 MySQL 数据库管理工具还是很好的,要不然也不会成为 MySQL 数据库的绝配.但是我想,很多人应该和重华一样,不太喜欢使用 web 端的工具,总觉得 ...
- openshift django目录结果
blog├── README.md├── requirements.txt├── setup.py├── static├── wsgi│ ├── application│ ├── db.sql ...
随机推荐
- [How to] 动态布局可变高度的cell的应用
1.简介 代码:https://github.com/xufeng79x/DynamicChangeableCell 微博界面,微信和QQ聊天界面,这些界面的布局大都不确定,且每一条消息的高度也不一样 ...
- 2017百度春招<度度熊买帽子的问题>
题目: 度度熊想去商场买一顶帽子,商场里有N顶帽子,有些帽子的价格可能相同.度度熊想买一顶价格第三便宜的帽子,问第三便宜的帽子价格是多少? 数组中找到第三小的数字 注意边界条件 用STL中的set来 ...
- Leetcode 之Largest Rectangle in Histogram(40)
又是一道构思巧妙的题,暴力求解复杂度太高,通过构造一个递增栈来解决:如果当前元素小于栈顶元素,则说明栈内已经构成一个 递增栈,则分别计算以每个元素为最低值的面积:反之,则入栈. int largest ...
- Spring + MyBatis 多数据源实现
近期,在项目中需要做分库,但是因为某些原因,没有采用开源的分库插件,而是采用了同事之前弄得多数据源形式实现的分库.对于多数据源,本人在实际项目也中遇到的不多,之前的项目大多是服务化,以RPC的形式获得 ...
- LeetCode解题报告—— Container With Most Water & 3Sum Closest & Letter Combinations of a Phone Number
1. Container With Most Water Given n non-negative integers a1, a2, ..., an, where each represents a ...
- python2下向文件写入unicode编码的内容,codecs包
python内置库中的open方法只能读写ascii码,如果想写入Unicode字符,需要使用codecs包. # -*- coding: utf-8 -*- import codecs import ...
- 确实,k8s的时代,ingress负载用traefik比nginx方便啊
参考文档: https://mritd.me/2016/12/06/try-traefik-on-kubernetes/#13ingress 由于微服务架构以及 Docker 技术和 kubernet ...
- 【转载】C++之继承与多态
转自:http://www.cnblogs.com/kunhu/p/3631285.html 在程序设计领域,一个广泛认可的定义是“一种将不同的特殊行为和单个泛化记号相关联的能力”.和纯粹的面向对象程 ...
- 单断言VS多断言
STST 想和大家讨论一下,一个测试用例里只做一个断言还是一个用例里做多个相关的断言 比如有一个查询函数Query(id) 返回[姓名,性别,年龄] 那么是在一个测试用例里对这三个属性进行断言好? 还 ...
- hibernate自连接--典型的oracle自带emp实现
用S2SH三大框架整合,用了oracle自带的表emp,实现了自连接. pojo类: public class Emp implements java.io.Serializable { // Fie ...