cert-manager

cert-manager

cert-manager는 인증서 관리를 자동화하는 도구예요. Istio 게이트웨이와 연동해서 TLS 인증서를 관리할 수 있어요.

출처: Istio 문서

본문

구성 (Configuration)

시작하려면 cert-manager 설치 문서를 참고해요. Istio와 함께 동작하기 위해 특별한 변경이 필요하지는 않아요.

사용법 (Usage)

Istio Gateway

cert-manager를 사용해 Kubernetes에 시크릿(secret)을 쓸 수 있고, 이 시크릿은 Gateway가 참조할 수 있어요.

시작하려면 cert-manager issuer 문서를 따라 Issuer 리소스를 구성해요. Issuer는 인증서 서명 요청(CSR)을 처리해서 서명된 인증서를 생성할 수 있는 인증 기관(CA)을 나타내는 Kubernetes 리소스예요. 예를 들어 Issuer는 다음과 같이 생겼어요:

apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
  name: ca-issuer
  namespace: istio-system
spec:
  ca:
    secretName: ca-key-pair

일반적인 Issuer 유형인 ACME의 경우, 클라이언트가 도메인을 소유하고 있는지 검증하기 위해 챌린지 요청에 응답하는 파드와 서비스가 생성돼요. 이런 챌린지에 응답하려면 http://<YOUR_DOMAIN>/.well-known/acme-challenge/<TOKEN> 엔드포인트에 도달할 수 있어야 해요. 이 구성은 구현별로 다를 수 있어요.

다음으로, cert-manager 문서를 따라 Certificate 리소스를 구성해요. Certificate는 istio-ingressgateway 배포와 같은 네임스페이스에 만들어야 해요. 예를 들어 Certificate는 다음과 같이 생겼어요:

apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
  name: ingress-cert
  namespace: istio-system
spec:
  secretName: ingress-cert
  commonName: my.example.com
  dnsNames:
  - my.example.com
  ...

인증서를 만들고 나면 istio-system 네임스페이스에 시크릿이 생성된 것을 확인할 수 있어요. 이 시크릿은 Gateway의 tls 구성에서 credentialName으로 참조할 수 있어요:

apiVersion: networking.istio.io/v1
kind: Gateway
metadata:
  name: gateway
spec:
  selector:
    istio: ingressgateway
  servers:
  - port:
      number: 443
      name: https
      protocol: HTTPS
    tls:
      mode: SIMPLE
      credentialName: ingress-cert # This should match the Certificate secretName
    hosts:
    - my.example.com # This should match a DNS name in the Certificate

Kubernetes Ingress

cert-manager는 Ingress 객체에 어노테이션을 구성해서 Kubernetes Ingress와 직접 연동할 수 있게 해줘요. 이 방법을 사용하면 시크릿이 같은 네임스페이스 내에서만 읽히기 때문에, Ingress가 istio-ingressgateway 배포와 같은 네임스페이스에 있어야 해요.

또는 Istio Gateway 에서 설명한 것처럼 Certificate를 만든 다음 Ingress 객체에서 참조할 수도 있어요:

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: ingress
  annotations:
    kubernetes.io/ingress.class: istio
spec:
  rules:
  - host: my.example.com
    http: ...
  tls:
  - hosts:
    - my.example.com # This should match a DNS name in the Certificate
    secretName: ingress-cert # This should match the Certificate secretName

See also

Apache SkyWalking — Apache SkyWalking과 연동하는 방법.

디버그 엔드포인트 (Debug Endpoints) — 모니터링과 트러블슈팅을 위해 istiod 디버그 엔드포인트에 접근하기.

Grafana — Grafana와 연동해서 Istio 대시보드를 구성하는 방법.

Jaeger — Jaeger와 연동하는 방법.

Kiali — Kiali와 연동하는 방법.

Prometheus — Prometheus와 연동하는 방법.

더 알아보기 (Learn more)