1、在1.7版本后使用HostAliases修改pod的hosts文件。该文件由kubelet管理
在deployment的yaml文件中添加在pod template 的spec里面即可:
apiVersion: extensions/v1beta1 kind: Deployment metadata: labels: app: runner name: gitlab-runner-gitlab-runner spec: replicas: 1 selector: matchLabels: app: runner strategy: rollingUpdate: maxSurge: 1 maxUnavailable: 1 type: RollingUpdate template: metadata: labels: app: runner spec: hostAliases: - hostnames: - gitlab.registry.com ip: 10.3.2.9 - hostnames: - reg.registry.com ip: 10.3.9.68 imagePullSecrets: - name: registry-secrete