创建ConfigMap

配置信息

如配置 MySQL 连接信息

文件名称: db-config.yaml

1
2
3
4
5
6
7
8
9
10
11
12
kind: ConfigMap
apiVersion: v1
metadata:
name: db-config
namespace: default
data:
DB_HOST: 127.0.0.1
DB_NAME: test
DB_PASS: test
DB_PORT: '5432'
DB_USER: test

部署配置

使用 kubectl 进行部署

1
kubectl apply -f db-config.yaml
阅读全文 »

外部访问

1
2
3
4
5
6
7
service.beta.kubernetes.io/aws-load-balancer-name: <负载均衡名称>

service.beta.kubernetes.io/aws-load-balancer-type: <类型>

service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: <目标类型>

service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
阅读全文 »

AWS

创建角色

1.IAM 新建角色

说明
服务 ec2
名称 admin
1
2
3
4
5
6
7
8
9
10
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "*",
"Resource": "*"
}
]
}
阅读全文 »

接口代理

1
2
3
4
5
6
7
8
9
10
11
location /apis {
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
rewrite ^/apis/(.*)$ /$1 break;
proxy_pass http://test.amazonaws.com:8082;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection upgrade;
}
阅读全文 »
0%