使用 Kubernetes 部署 Openresty

2019-08-24 21:54:07
收藏数:0
阅读数:701
评论数:0

使用Kubernetes 部署OpenResty

apiVersion: v1
kind: Namespace
metadata:
    name: openresty-ns
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  namespace: openresty-ns
  name: openresty
spec:
  rules:
    - host: api.lua-china.local
      http:
        paths:
          - backend:
              serviceName: openresty-svc
              servicePort: 80
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  namespace: openresty-ns
  name: openresty
spec:
  replicas: 3
  template:
    metadata:
      labels:
       app: openresty
    spec:
      containers:
        - name: openresty
          image: horan/lua-china-api:0.1 # 替换为你自己的镜像
          ports:
          - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
   namespace: openresty-ns
   name: openresty-svc
spec:
 selector:
   app: openresty
 clusterIP: None
 ports:
   - name: http
     protocol: TCP
     port: 80