관리형 서비스

서비스 찾기

kf marketplace 명령어를 사용하여 앱에 사용하려는 서비스를 찾습니다. 인수 없이 이 명령어를 실행하면 사용 가능한 모든 서비스 클래스가 표시됩니다. 서비스 클래스는 서비스의 특정 유형을 나타냅니다(예: MySQL 데이터베이스 또는 Postfix SMTP 릴레이).

$ kf marketplace
5 services can be used in Space "test", use the --service flag to list the plans for a service

Broker      Name        Space      Status  Description
minibroker  mariadb                Active  Helm Chart for mariadb
minibroker  mongodb                Active  Helm Chart for mongodb
minibroker  mysql                  Active  Helm Chart for mysql
minibroker  postgresql             Active  Helm Chart for postgresql
minibroker  redis                  Active  Helm Chart for redis

서비스 클래스는 여러 요금제를 가질 수 있습니다. 서비스 요금제는 일반적으로 소프트웨어의 버전 또는 가격 책정 등급에 해당합니다. 마켓플레이스 명령어에 서비스 이름을 제공하여 특정 서비스의 요금제를 볼 수 있습니다.

$ kf marketplace --service mysql
Name    Free  Status  Description
5-7-14  true  Active  Fast, reliable, scalable, and easy to use open-source relational database system.
5-7-27  true  Active  Fast, reliable, scalable, and easy to use open-source relational database system.
5-7-28  true  Active  Fast, reliable, scalable, and easy to use open-source relational database system.

서비스 프로비저닝

프로니저닝할 서비스 클래스와 요금제를 식별했다면 kf create-service를 사용하여 서비스 인스턴스를 만들 수 있습니다.

$ kf create-service mysql 5-7-28 my-db
Creating service instance "my-db" in Space "test"
Waiting for service instance to become ready...
Success

서비스는 단일 공간에 프로비저닝됩니다. kf services를 실행하여 현재 공간의 서비스를 확인할 수 있습니다.

$ kf services
Listing services in Space: "test"
Name   ClassName  PlanName  Age   Ready  Reason
my-db  mysql      5-7-28    111s  True   <nil>

kf delete-service를 사용하여 서비스를 삭제할 수 있습니다.

$ kf delete-service my-db

서비스 결합

서비스가 생성되면 앱에 결합할 수 있으며, 그러면 사용자 인증 정보를 앱에 삽입하여 서비스를 사용할 수 있게 됩니다. kf bind-service를 사용하여 결합을 생성하세요.

$ kf bind-service my-app my-db
Creating service instance binding "binding-my-app-my-db" in Space "test"
Waiting for service instance binding to become ready...
Success

kf bindings 명령어를 사용하여 공간에 모든 결합을 나열할 수 있습니다.

$ kf bindings
Listing bindings in Space: "test"
Name                  App     Service  Age  Ready
binding-my-app-my-db  my-app  my-db    82s  True

서비스가 결합되면 kf restart를 사용하여 앱을 다시 시작합니다. 사용자 인증 정보는 VCAP_SERVICES 환경 변수에 있습니다.

kf unbind-service 명령어로 서비스 결합을 삭제할 수 있습니다.

$ kf unbind-service my-app my-db