0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Kubernetes(EKS)でHost設定したい場合

Last updated at Posted at 2025-01-10

はじめに

自分の備忘のため、簡単な内容ですが忘れそうなので記事に

Host設定(公式情報)

以下はPodでの定義についての言及であり、DeploymentでPodを管理している場合はDeploymentにHost設定を記述する必要があります。
https://kubernetes.io/ja/docs/tasks/network/customize-hosts-file-for-pods/

DeploymentにおけるHost設定

hostAliases部分に記載します

deployment.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx
spec:
  replicas: 2
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
 #以下、Host設定部分
    spec:
      hostAliases:
      - ip: "127.0.0.1"
        hostnames:
        - "foo.local"
        - "bar.local"
 #ここまで
      containers:
      <以下省略>
      
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?