8.2.3.2. 기본 인증을 위한 샘플 YAML
다음 샘플은 ns1 네임스페이스에 example-basic-auth 라는 Secret 오브젝트에 대한 기본 인증 설정을 보여줍니다.
기본 인증 시크릿의 예
apiVersion: v1
kind: Secret
metadata:
name: example-basic-auth
namespace: ns1
stringData:
user: <basic_username>
password: <basic_password>
다음 샘플에서는 ServiceMonitor CRD의 기본 인증 설정을 보여줍니다. 이 예제에서는 example-basic-auth:이라는 Secret 오브젝트를 사용합니다.
기본 인증 설정 예
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: prometheus-example-monitor
namespace: ns1
spec:
endpoints:
- basicAuth:
username:
key: user
name: example-basic-auth
password:
key: password
name: example-basic-auth
port: web
selector:
matchLabels:
app: prometheus-example-app