deployment-app.yaml 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. apiVersion: v1
  2. kind: Namespace
  3. metadata:
  4. name: {{.repo_namespace}}
  5. ---
  6. apiVersion: apps/v1
  7. kind: Deployment
  8. metadata:
  9. name: {{.repo_name}}
  10. namespace: {{.repo_namespace}}
  11. spec:
  12. selector:
  13. matchLabels:
  14. app: {{.repo_name}}
  15. replicas: 1
  16. template:
  17. metadata:
  18. labels:
  19. app: {{.repo_name}}
  20. annotations:
  21. dapr.io/enabled: "true"
  22. dapr.io/app-id: {{.repo_name}}
  23. dapr.io/app-port: "80"
  24. spec:
  25. imagePullSecrets:
  26. - name: harbor-registry-secret
  27. containers:
  28. - name: {{.repo_name}}
  29. imagePullPolicy: Always
  30. image: {{.image_addr}}
  31. ports:
  32. - containerPort: 80
  33. ---
  34. apiVersion: v1
  35. kind: Service
  36. metadata:
  37. name: {{.repo_name}}-svc
  38. namespace: {{.repo_namespace}}
  39. spec:
  40. selector:
  41. app: {{.repo_name}}
  42. type: NodePort
  43. ports:
  44. - protocol: TCP
  45. port: 80
  46. targetPort: 80
  47. nodePort: 30016
  48. ---
  49. # 私有仓库
  50. apiVersion: v1
  51. kind: Secret
  52. metadata:
  53. name: harbor-registry-secret
  54. namespace: {{.repo_namespace}}
  55. type: kubernetes.io/dockerconfigjson
  56. data:
  57. .dockerconfigjson: eyJhdXRocyI6eyJoYXJib3Iuc3hpZGMuY29tIjp7InVzZXJuYW1lIjoiZHJvbmUiLCJwYXNzd29yZCI6IkRyb25lMTIzNDU2IiwiYXV0aCI6IlpISnZibVU2UkhKdmJtVXhNak0wTlRZPSJ9fX0=