Kubernetes在pod中配置hosts解析域名
apiVersion: apps/v1beta2
kind: Deployment
metadata:
annotations:
deployment.kubernetes.io/revision: "2"
creationTimestamp: "2020-09-11T08:35:00Z"
generation: 2
labels:
k8s-app: nginx-hosts-alis
qcloud-app: nginx-hosts-alis
name: nginx-hosts-alis
namespace: test
resourceVersion: "12673987137"
selfLink: /apis/apps/v1beta2/namespaces/test/deployments/nginx-hosts-alis
uid: 61493e8e-b0c9-4b5d-a031-6ea2799e9de8
spec:
progressDeadlineSeconds: 600
replicas: 1
revisionHistoryLimit: 10
selector:
matchLabels:
k8s-app: nginx-hosts-alis
qcloud-app: nginx-hosts-alis
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
type: RollingUpdate
template:
metadata:
creationTimestamp: null
labels:
k8s-app: nginx-hosts-alis
qcloud-app: nginx-hosts-alis
spec:
containers:
- image: nginx
imagePullPolicy: Always
name: nginx-hosts-alis
resources:
limits:
cpu: 500m
memory: 1Gi
requests:
cpu: 250m
memory: 256Mi
securityContext:
privileged: false
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
dnsPolicy: ClusterFirst
hostAliases:
- hostnames:
- foo.local
- bar.local
ip: 127.0.0.1
- hostnames:
- foo.remote
- bar.remote
ip: 10.1.2.3
restartPolicy: Always
schedulerName: default-scheduler
securityContext: {}
terminationGracePeriodSeconds: 30最后更新于