1、创建docker秘钥

  1. kubectl create secret docker-registry testharbor --docker-server=http://harbor.lianhang.jetair --docker-username=flycua --docker-password=Jetair0com --docker-email=zhangshangbj@163.com

2、创建serviceAccount

创建方法1
  1. # 使用命令行创建serviceAccount
  2. kubectl create serviceaccount mobile -n mobile
  3. # 修改serviceaccount 清单配置
  4. kubect edit serviceaccount mobile -n mobile
  5. # Please edit the object below. Lines beginning with a '#' will be ignored,
  6. # and an empty file will abort the edit. If an error occurs while saving this file will be
  7. # reopened with the relevant failures.
  8. #
  9. apiVersion: v1
  10. kind: ServiceAccount
  11. metadata:
  12. creationTimestamp: "2019-07-23T08:53:28Z"
  13. name: mobile
  14. namespace: mobile
  15. resourceVersion: "91050"
  16. selfLink: /api/v1/namespaces/mobile/serviceaccounts/mobile
  17. uid: 569d7624-ad27-11e9-943e-0af46e9414b9
  18. secrets:
  19. - name: mobile-token-t7kzp
  20. #在metadata平级下添加
  21. imagePullSecrets:
  22. - name: testharbor
创建方法2
  1. #使用配置清单
  2. vim mobile_serviceaccount.yml
  3. apiVersion: v1
  4. kind: ServiceAccount
  5. metadata:
  6. name: mobile
  7. namespace: mobile
  8. imagePullSecrets:
  9. - name: testharbor
  10. # 应用配置清单
  11. kubectl apply -f mobile_serviceaccount.yml
文档更新时间: 2019-08-06 15:37   作者:张尚