Run script to prepare for k8s deployment

Version: 10.5

The Sitecore container deployment package provides scripts for automating some of the preparations for Sitecore deployment to a developer machine. The k8s-init.ps1 and k8s-init-upgrade.ps1 files are located with the secrets and configmaps folders.

The k8s-init.ps1 file performs the following actions:

  • compresses the Sitecore license file 
  • creates the Identity Server token signing certificate  
  • populates the secrets folder  
  • updates the configmaps hostname files 
  • generates TLS/HTTPS certificates  
  • installs the root certificate into your Trusted Root Certification Authorities  
  • updates Windows host names

The k8s-init-upgrade.ps1 file performs the following actions:

  • compresses the Sitecore license file 
  • populates the secrets folder

The scripts accept a number of parameters. The following table shows the parameters you can use.

ParameterDescriptionExampleMandatory
LicenseXmlPathPath to the Sitecore license file. You must specify this.-LicenseXmlPath "c:\license.xml"Yes
TopologyThe name of your chosen topology-Topology "XM1"No
IdHostA custom host name for the Identity Server-IdHost mySCID_1No
CdHostA custom host name for the CD server-CdHost mySCCD_1No
CmHostA custom host name for the CM server-CmHost mySCCM_1No
ExternalIPAddressEXTERNAL-IP address for the ingress-ExternalIPAddress 52.236.147.141Yes
SecretsFolderPathPath to the folder where the secrets (*.txt files) are located. Specify this if the secrets are not located in .\secrets.  For upgrade specify this if the secrets are not located in .\configuration.-SecretsFolderPath "c:\k8s\ secrets"No
CertDataFolderPath to the folder where the TLS certificates are located. Specify this if the certificates are not located in .\secrets\tls-CertDataFolder "c:\k8s\ secrets\tls"No
ConfigmapsDataFolderPath to the folder where the hostname files for cd, cm, id are located. Specify this if the certificates are not located in .\configmaps-ConfigmapsDataFolder "c:\k8s\configmaps"No
SitecoreAdminPasswordA custom password for the admin user-SitecoreAdminPassword df8732V45GHYes
SqlServerName of the Sql server instance-SqlServer “mssql”No
SqlUserNameName of the user of sql server-SqlUserName “sa”Yes
SqlUserPasswordA custom password for the SQL server user-SqlUserPassword poi34l2xGH45Yes
SqlCoreDatabasePasswordA custom password for the Core database-SqlCoreDatabasePassword poi34l2xGH45No
SqlFormsDatabasePasswordA custom password for the Forms database-SqlFormsDatabasePassword poi34l2xGH45No
SqlMasterDatabasePasswordA custom password for the Master database-SqlMasterDatabasePassword poi34l2xGH45No
SqlWebDatabasePasswordA custom password for the Web database-SqlWebDatabasePassword poi34l2xGH45No
SqlCollectionShardmapmanagerDatabasePasswordA custom password for the CollectionShardmapmanager database-SqlCollectionShardmapmanagerDatabasePassword poi34l2xGH45No
SqlExmMasterDatabasePasswordA custom password for the ExmMaster database.-SqlExmMasterDatabasePassword poi34l2xGH45No
SqlMarketingAutomationDatabasePasswordA custom password for the MarketingAutomation database-SqlMarketingAutomationDatabasePassword poi34l2xGH45No
SqlMessagingDatabasePasswordA custom password for the Messaging database-SqlMessagingDatabasePassword poi34l2xGH45No
SqlProcessingEngineStorageDatabasePasswordA custom password for the ProcessingEngineStorage database-SqlProcessingEngineStorageDatabasePassword poi34l2xGH45No
SqlProcessingEngineTasksDatabasePasswordA custom password for the ProcessingEngineTasks database-SqlProcessingEngineTasksDatabasePassword poi34l2xGH45No
SqlProcessingPoolsDatabasePasswordA custom password for the ProcessingPools database-SqlProcessingPoolsDatabasePassword poi34l2xGH45No
SqlProcessingTasksDatabasePasswordA custom password for the ProcessingTasks database-SqlProcessingTasksDatabasePassword poi34l2xGH45No
SqlReferenceDataDatabasePasswordAcustom password for the ReferenceData database-SqlReferenceDataDatabasePassword poi34l2xGH45No
SqlReportingDatabasePasswordA custom password for the Reporting database-SqlReportingDatabasePassword poi34l2xGH45No
IsAlwaysEncryptedOption for sql server which allows using of encryption (only for upgrade folder)-IsAlwaysEncrypted $falseNo
ProcessingEngineTasksDatabaseUserNameName of the least privileged user in database (only for upgrade folder)-ProcessingEngineTasksDatabaseUsername  “dbo”No
SitecoreGalleryRepositoryLocationPath to the location of the Sitecore Gallery repository. Specify this if you are not using the official repository-

SitecoreGalleryRepositoryLocation "https:\<path_to_repository>"
No
SpecificVersionDefine and install the specific version for SitecoreDockerTools module-SpecificVersion “specific version”No
SqlServerCertificatePasswordPassword set for certificate created for SqlServer-SqlServerCertificatePassword df8732V45GHNo
SolrAdminUserNameAdmin Username used in Solr-SolrAdminUsername adminNo
SolrAdminPasswordAdmin Password used in Solr-SolrAdminPassword df8732V45GHYes
SolrConnectionUserNameUserName for user used in connection of Sitecore to Solr-SolrConnectionUserName sitecoreNo
SolrConnectionPasswordPassword for user used in connection of Sitecore to Solr-SolrConnectionPassword df8732V45GHYes
SolrProtocolHttp/Https used to connect to the Solr Instance-SolrProtocol “http”No
SolrInstanceHost name / instance name of Solr-SorlInstance “solr”No
SolrPortPort of Solr-SolrPort 8983No

To use the script:

  1. Open a Windows PowerShell console (or the ISE) with administrator access (for now, supporting PowerShell version is 5.X). Navigate to the folder containing the k8s-init.ps1 or k8s-init-upgrade.ps1 file.

  2. Run the script. For example:

    .\k8s-init.ps1 -Topology "<your_topology>" -LicenseXmlPath "<path_to_the_license_file>" -IdHost <custom_Id_host_name> -CdHost <custom_cd_host_name> -CmHost <custom_cm_host_name> -ExternalIPAddress <external_ip_address> -SqlUserPassword <sql_user_password> -SqlUserName <sql_user_name> -SitecoreAdminPassword <sitecore_admin_password> -SolrAdminPassword <solr_admin_password> -SolrConnectionPassword <solr_connection_password>
    .\k8s-init-upgrade.ps1 -LicenseXmlPath "<path_to_the_license_file>" -SqlUserPassword "<sql_user_password>" -SqlUserName "<sql_user_name>"
Note

If your TLS certificates folder (“.\secrets\tls”) already contains certificates the script does not install new certificates.

If a custom password for specific databases (core, master, web etc.) is empty, then the random password will be set for the specific user.

If you have suggestions for improving this article, let us know!