自制镜像很麻烦, 而且坑很多, 之前自建了一个, 导致启不来, 还是直接下载官方的方便好用.
下载官方镜像
上传镜像:
关于使用官方ubuntu镜像无法使用ssh用户名密码登录登录的问题
在创建instance的时候,选择创建后,然后选择直接输入,输入如下代码
ubuntu
Centos7
自制镜像很麻烦, 而且坑很多, 之前自建了一个, 导致启不来, 还是直接下载官方的方便好用.
下载官方镜像
1 |
http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-1708.qcow2 |
上传镜像:
1 |
glance image-create --name centos-7 --disk-format qcow2 --container-format bare < CentOS-7-x86_64-GenericCloud-1708.qcow2 |
关于使用官方ubuntu镜像无法使用ssh用户名密码登录登录的问题
在创建instance的时候,选择创建后,然后选择直接输入,输入如下代码
ubuntu
1 2 3 4 5 6 7 8 |
#!/bin/sh sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/g' /etc/ssh/sshd_config sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config cp -f /home/ubuntu/.ssh/authorized_keys /root/.ssh/ service ssh restart passwd ubuntu<<EOF 123456 123456 |
Centos7
1 2 3 4 5 6 7 8 9 10 11 12 13 |
#!/bin/sh sed -i 's/PermitRootLogin without-password/PermitRootLogin yes/g' /etc/ssh/sshd_config sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config cp -f /home/centos/.ssh/authorized_keys /root/.ssh/ systemctl restart sshd cp -r /usr/share/zoneinfo/Asia/Shanghai /etc/localtime echo "1450" > /sys/class/net/eth0/mtu passwd root<<EOF xxxxxx xxxxxx EOF 注: 密码必须满足8个字符的长度 |
问题 使用ansible mitogen 0.3.4插件进行kubespray安装时,报错: EOF on stream; last 100 lines received:\nssh: Could not resolve hostname {%: Name or service not known 分析 经过debug分析,kubespray-default默认定义了如下变量模板: [crayon-6812369d8c1d0295565578/] 但是通过ansible role去执行后,通过mitogen进行ssh并没有渲染出来变量: [crayon-6812369d8c1d3430497583/] 可以看到,mitogen的ssh将ansible_ssh_common_args原封不动地输出来了 修改源码验证: 修改transport_config.py, 增加debug信息: [crayon-6812369d8c1d5943811085/] 下面是输出: [crayon-6812369d8c1d6362651861/] Read more…
使用docker-compose安装harbor,配置ssl证书后使用nginx反向代理到harbor.配置后安装docker可以直接用域名登录harbor,无需配置私有仓库 nginx配置 1.修改harbor配置文件 [crayon-6812369d8da16601939624/] 2.nginx配置 [crayon-6812369d8da1a981328747/] 另: 创建证书脚本: [crayon-6812369d8da1c325267814/] 问题: docker pull ycr.yyiuap.com/base/golang:alphine-node-3 Error response from daemon: received unexpected HTTP status: 503 Service Unavailable 解决: 去掉 http_proxy代理即可 参考:https://blog.csdn.net/oscarun/article/details/121395218 1、request canceled while waiting Read more…
nginx转发post请求静态页面405 背景:用户支付成功后的回调是个静态页面。由于from表单连续提交是post方式,所以会报405 not allowed 错误。 常识:使用post方式请求js、html这样的静态文件一般的web服务器都会返回405 Method Not Allowed。因为默认情况下,nginx、apache、IIs等web服务无法响应静态页面的post请求,后端用来处理post请求,生产环境中不会有此问题(一般都不允许配置静态页面的post请求) 问题:为什么默认不支持静态页面post请求呢? 首先了解一下post请求方法,post请求一般用于提交表单或上传文件,post请求会导致新资源的建立或旧资源的更改。就安全方面来说(排除url地址的透明性),它对比get请求会有更改资源的情况,有些静态资源是不允许更改的,所以默认情况下web服务器上的静态资源都不允许发起post请求。 网上说的有很多种,重新编译nginx,设置正则匹配可以访问html文件类啊什么的,都不好用,而且基本都是你抄我我抄你,没有实际应用过。乱糟糟,最后本人用下面这种方式解决了问题。 [crayon-6812369d8db24386021297/] Nginx配置跨域请求 Access-Control-Allow-Origin * 当出现403跨域错误的时候 No 'Access-Control-Allow-Origin' header is present on the requested resource,需要给Nginx服务器配置响应的header参数: 一、 解决方案 只需要在Nginx的配置文件中配置以下参数: [crayon-6812369d8db28855008913/] 二、 解释 1. Access-Control-Allow-Origin [crayon-6812369d8db29835490455/] 2. Access-Control-Allow-Headers 是为了防止出现以下错误: Request Read more…
3 Comments
nba 2k18 my career walkthrough · 05/23/2019 at 1:35 AM
certainly like your web-site but you have to check the spelling on quite a few of your posts. Many of them are rife with spelling issues and I find it very bothersome to tell the truth nevertheless I’ll definitely come back again.
sean · 05/24/2019 at 12:37 AM
Glad you like it, i will do better in future
ปั้มไลค์ · 07/03/2020 at 10:23 AM
Like!! Really appreciate you sharing this blog post.Really thank you! Keep writing.