LoginSignup
0
0

[k8s] 自己署名証明書でkubernetesのIngressのTLS設定をしてみた

Last updated at Posted at 2023-12-30

はじめに

前回はfluxの通知がslackに流れるように設定を行いました。

今回は自己署名証明書を用いてingressのTLS設定を行なっていこうと思います。

手順

秘密鍵を作成

$ openssl genpkey -algorithm ed25519 -out priv.key

自己署名証明書を作成

$ openssl req -x509 -days 3650 -new -key priv.key -out server.crt

Secretを作成

kubectl create secret tls cluster-tls --key priv.key --cert server.crt

Ingressのspec.tlsを次のように記述

...
kind: Ingress
spec:
  tls:
    - hosts:
        - www.example.com
      secretName: cluster-tls
...

これで自己署名証明書を用いたTLS通信ができるようになりました。

kubectl get ingressでHTTPSができるようになっていることを確認します。

$ kubectl get ingress
NAME                CLASS   HOSTS                     ADDRESS         PORTS     AGE
app-ingress      nginx   www.example.com        192.168.11.61   80, 443   35h

参考資料

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