ambassador 学习一基本试用

安装使用docker for mac

Without RBAC

安装ambassador

  • 安装
kubectl apply -f https://getambassador.io/yaml/ambassador/ambassador-no-rbac.yaml
  • 创建service
---
apiVersion: v1
kind: Service
metadata:
  name: ambassador
spec:
  type: NodePort
  ports:
   - port: 80
  selector:
    service: ambassador
kubectl apply -f ambassador-service.yaml
  • 状态

部署简单服务

  • service yaml (qotm.yaml)
---
apiVersion: v1
kind: Service
metadata:
  name: qotm
  annotations:
    getambassador.io/config: |
      ---
      apiVersion: ambassador/v0
      kind:  Mapping
      name:  qotm_mapping
      prefix: /qotm/
      service: qotm
spec:
  selector:
    app: qotm
  ports:
  - port: 80
    name: http-qotm
    targetPort: http-api
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: qotm
spec:
  replicas: 1
  strategy:
    type: RollingUpdate
  template:
    metadata:
      labels:
        app: qotm
    spec:
      containers:
      - name: qotm
        image: datawire/qotm:1.1
        ports:
        - name: http-api
          containerPort: 5000
        resources:
          limits:
            cpu: "0.1"
            memory: 100Mi
kubectl apply -f qotm.yaml

测试

  • 查看服务状态
kubectl get svc -o wide ambassador

  • 访问

查询统计信息

  • service list
  • 访问统计信息查看
  • 访问界面
http://localhost:32598

  • 服务统计信息

参考资料

https://www.getambassador.io/user-guide/getting-started
https://github.com/rongfengliang/ambassador-learning

posted on 2018-07-05 19:30  荣锋亮  阅读(749)  评论(0编辑  收藏  举报

导航