开通容器服务
开通前
开通并创建集群后(这里使用按量付费的ECS机器,测试后即可释放)
配置节点完成后
配置无状态应用
一开始我是直接使用的 yaml
进行创建
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nginx
name: nginx-deployment-basic
namespace: default
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
app: nginx
strategy:
rollingUpdate:
maxSurge: 25%
maxUnavailable: 25%
type: RollingUpdate
template:
metadata:
labels:
app: nginx
spec:
containers:
- image: 'nginx:1.7.9'
imagePullPolicy: IfNotPresent
name: nginx
ports:
- containerPort: 80
protocol: TCP
readinessProbe:
failureThreshold: 3
httpGet:
path: /
port: 80
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
resources: {}
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30
结果是 failure
, 因为我是VPC网络并且没有开通SLB和弹性IP,所以拉不下来镜像.
开通NAT网关
开通需要在NAT网关上添加SNAT条目,绑定ECS/交换机走NAT网关的流量进出
绑定时发现需要先申请弹性IP.