安装使用docker for mac

安装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
  • 状态
    ambassador 学习一基本试用-LMLPHP

部署简单服务

  • 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

ambassador 学习一基本试用-LMLPHP

  • 访问
    ambassador 学习一基本试用-LMLPHP

查询统计信息

  • service list
    ambassador 学习一基本试用-LMLPHP
  • 访问统计信息查看
  • 访问界面
http://localhost:32598

ambassador 学习一基本试用-LMLPHP

  • 服务统计信息
    ambassador 学习一基本试用-LMLPHP

参考资料

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

 
 
 
 
05-11 22:06