k8s modify pod hosts file

1, HostAliases modify the hosts file in the pod after the 1.7 version. This file is managed by kubelet

In yaml file deployment added in a pod template inside the spec can:

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

 

Guess you like

Origin www.cnblogs.com/cuishuai/p/11924777.html