Replicated Ship 本地 kubernetes 环境试用

关于介绍可以参考 https://github.com/replicatedhq/ship 或者我写的一个比较简单的demo
https://www.cnblogs.com/rongfengliang/p/10025786.html

测试使用的是github repo, 如果不是,命令行工具会有提示,告诉我们格式

工具安装

可以参考 https://www.cnblogs.com/rongfengliang/p/10025786.html

brew tap replicatedhq/ship
brew install ship

kubernetesmanifests

备注需要是github 格式的repo

  • manifests 文件内容
---
# Source: nginx-app/templates/service.yaml
apiVersion: v1
kind: Service
metadata:
  name: appdemorong-nginx-app
  labels:
    app.kubernetes.io/name: nginx-app
    helm.sh/chart: nginx-app-0.1.0
    app.kubernetes.io/instance: appdemorong
    app.kubernetes.io/managed-by: Tiller
spec:
  type: NodePort
  ports:
    - port: 80
      targetPort: http
      protocol: TCP
      name: http
  selector:
    app.kubernetes.io/name: nginx-app
    app.kubernetes.io/instance: appdemorong

---
# Source: nginx-app/templates/deployment.yaml
apiVersion: apps/v1beta2
kind: Deployment
metadata:
  name: appdemorong-nginx-app
  labels:
    app.kubernetes.io/name: nginx-app
    helm.sh/chart: nginx-app-0.1.0
    app.kubernetes.io/instance: appdemorong
    app.kubernetes.io/managed-by: Tiller
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/name: nginx-app
      app.kubernetes.io/instance: appdemorong
  template:
    metadata:
      labels:
        app.kubernetes.io/name: nginx-app
        app.kubernetes.io/instance: appdemorong
    spec:
      containers:
        - name: nginx-app
          image: "nginx:stable"
          imagePullPolicy: IfNotPresent
          ports:
            - name: http
              containerPort: 80
              protocol: TCP
          livenessProbe:
            httpGet:
              path: /
              port: http
          readinessProbe:
            httpGet:
              path: /
              port: http
          resources:
            {}


---
# Source: nginx-app/templates/ingress.yaml

使用ship 部署

  • init
ship init github.com/rongfengliang/ship-k8s-demo

从下图可以看出,会自动进行项目类型的判断,还是很方便的,之后会提示是否使用ui工具,进行配置
效果

  • UI 配置(生成kustomize&&部署文件)



    上边的确认之后,会自动退出UI
  • 生成的文件
  • 部署
    参考ui的说明就可以了
kubectl apply -f rendered.yaml

  • 变更捕获&&更新
    修改github,查看变更信息
ship watch && ship update


修改镜像为openresty

参考资料

https://github.com/replicatedhq/ship
https://www.cnblogs.com/rongfengliang/p/10025786.html

posted on 2018-11-27 16:11  荣锋亮  阅读(415)  评论(0编辑  收藏  举报

导航