环境变量

变量名称 变量值 说明
SERVICE_ACCOUNT_NAME nocalhost Account名称
NOCALHOST_SECRET nocalhost-secret Secret名称

export SERVICE_ACCOUNT_NAME="nocalhost"

export NOCALHOST_SECRET="nocalhost-secret"

1. 创建具有 cluster-admin 权限的 ServiceAccount

阅读全文 »

创建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
阅读全文 »

接口代理

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%