In this tutorial series we will discuss:
- How to deploy a Service Fabric managed cluster
- How to scale out a Service Fabric managed cluster
- How to add and remove nodes in a Service Fabric managed cluster
- How to deploy an application to a Service Fabric managed cluster
This part of the series covers how to:
- Connect to your Service Fabric managed cluster
- Upload an application to a cluster
- Instantiate an application in a cluster
- Remove an application from a cluster
필수 조건
- A Service Fabric managed cluster (see Deploy a managed cluster).
클러스터에 연결
To connect to your cluster, you'll need the cluster certificate thumbprint. 리소스 배포의 클러스터 속성 출력에서 또는 기존 리소스의 클러스터 속성을 쿼리하여 이 값을 찾을 수 있습니다.
다음 명령을 사용하여 클러스터 인증서 지문에 대한 클러스터 리소스를 쿼리할 수 있습니다.
$serverThumbprint = (Get-AzResource -ResourceId /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/myResourceGroup/providers/Microsoft.ServiceFabric/managedclusters/mysfcluster).Properties.clusterCertificateThumbprints
클러스터 인증서 지문을 사용하여 클러스터에 연결할 준비가 된 것입니다.
$connectionEndpoint = "mysfcluster.eastus2.cloudapp.azure.com:19000"
Connect-ServiceFabricCluster -ConnectionEndpoint $connectionEndpoint -KeepAliveIntervalInSec 10 `
-X509Credential `
-ServerCertThumbprint $serverThumbprint `
-FindType FindByThumbprint `
-FindValue $clientThumbprint `
-StoreLocation CurrentUser `
-StoreName My
Upload an application package
In this tutorial, we will be using the Service Fabric Voting Application sample. For more details on Service Fabric application deployment through PowerShell see Service Fabric deploy and remove applications.
비고
In the Service Fabric managed cluster preview you will not be able to publish applications directly from Visual Studio.
You will first need to package the application for deployment. For this tutorial, please follow the steps for packaging an application from within Visual Studio. It is important to take note of the path where the application has been packaged as it will be used for the path below.
Once the application package has been created you can upload the application package to your cluster. Update the $path value to represent the path where your application package exists, and run the following:
$path = "C:\Users\<user>\Documents\service-fabric-dotnet-quickstart\Voting\pkg\Debug"
Copy-ServiceFabricApplicationPackage -ApplicationPackagePath $path -CompressPackage
Register-ServiceFabricApplicationType -ApplicationPathInImageStore Debug
애플리케이션 만들기
You can instantiate an application from any application type version that has been registered successfully by using the New-ServiceFabricApplication cmdlet. The name of each application must start with the "fabric:" scheme and must be unique for each application instance. Any default services defined in the application manifest of the target application type are also created.
New-ServiceFabricApplication fabric:/Voting VotingType 1.0.0
Once this operation completes, you should see your application instances running in the Service Fabric Explorer.
애플리케이션 제거
When an application instance is no longer needed, you can permanently remove it by name using the Remove-ServiceFabricApplication cmdlet, which also automatically removes all services that belong to the application, permanently removing all service state.
Remove-ServiceFabricApplication fabric:/Voting
다음 단계
In this step, we deployed an application to a Service Fabric managed cluster. To learn more about application deployment options, see:
- Deploy application secrets to a managed cluster
- Azure Resource Manager를 사용하여 관리형 클러스터에 애플리케이션 배포
- Deploy an application with managed identity to a managed cluster
To learn more about managed cluster configuration options, see: