0% found this document useful (0 votes)
2 views9 pages

Lab.-running SQL Server on Google Kubernetes Engine

This lab guides users through creating a Kubernetes cluster in Google Kubernetes Engine (GKE) and deploying a Microsoft SQL Server database within it. Participants learn to connect to the database from a client machine and manage the deployment. The lab includes step-by-step instructions for setup, configuration, and cleanup of resources.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views9 pages

Lab.-running SQL Server on Google Kubernetes Engine

This lab guides users through creating a Kubernetes cluster in Google Kubernetes Engine (GKE) and deploying a Microsoft SQL Server database within it. Participants learn to connect to the database from a client machine and manage the deployment. The lab includes step-by-step instructions for setup, configuration, and cleanup of resources.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Running SQL Server on Google Kubernetes Engine

experimentLabschedule2 horasuniversal_currency_alt5 créditosshow_chartIntermedio

student-04-6280330b63f4@qwiklabs.net
rkBlUmEZ0m4F
qwiklabs-gcp-03-cbf6727e4995
infoEs posible que este lab incorpore herramientas de IA para facilitar tu aprendizaje.
Overview
In this lab, you create a Kubernetes cluster in Google Kubernetes Engine (GKE). You configure and
deploy a Microsoft SQL Server database into the cluster and connect to it from a client machine.
Objectives
In this lab, you learn how to perform the following tasks:
 Create a Kubernetes cluster.
 Configure and deploy SQL Server into the cluster.
 Connect to the SQL Server database from a client machine.
Setup and requirements
In this task, you use Qwiklabs and perform initialization steps for your lab.
For each lab, you get a new Google Cloud project and set of resources for a fixed time at no cost.
1. Sign in to Qwiklabs using an incognito window.
2. Note the lab's access time (for example, 1:15:00), and make sure you can finish within that
time.
There is no pause feature. You can restart if needed, but you have to start at the beginning.
3. When ready, click Start lab.
4. Note your lab credentials (Username and Password). You will use them to sign in to the
Google Cloud Console.
5. Click Open Google Console.
6. Click Use another account and copy/paste credentials for this lab into the prompts.
If you use other credentials, you'll receive errors or incur charges.
7. Accept the terms and skip the recovery resource page.
Note: Do not click End Lab unless you have finished the lab or want to restart it. This clears your
work and removes the project.
Task 1. Create a Kubernetes cluster
1. Open a new web browser window and navigate to the Google Cloud Console.
2. Use the project selector to choose the first project with a leading name of 'qwiklabs-gcp.'
3. Click Activate Cloud Shell ( ) in the upper right of the Console.
The Cloud Shell terminal will open in a pane at the bottom of the window.
4. To create a Kubernetes cluster, enter the following command:
gcloud container clusters create kubernetes-cluster --zone=Zone
Se copió correctamente
content_copy
It will take a few minutes for the cluster to be ready.
5. When the cluster is ready, enter the following command to connect to it:
gcloud container clusters get-credentials kubernetes-cluster --zone Zone
Se copió correctamente
content_copy
6. To test your connection, enter the following command:
kubectl get nodes
Se copió correctamente
content_copy
Machines (nodes) that make up the cluster are listed.
Click Check my progress to verify the objective.
Create a Kubernetes cluster
Revisar mi progreso
Task 2. Configure and deploy SQL Server into the cluster
1. Clone the following GitHub repository, which has the SQL Server configuration files already
created for you:
git clone https://github.com/GoogleCloudPlatform/training-data-analyst
Se copió correctamente
content_copy
2. Change to the following folder:
cd ~/training-data-analyst/courses/db-migration/sql-server-on-gke
Se copió correctamente
content_copy
3. Click Open Editor, and then select
the training-data-analyst/courses/db-migration/sql-server-on-gke folder.
4. Select the volume-claims.yaml file.
This file configures three volumes: one for the SQL Server software, one for the data, and
one for the transaction logs.
5. Select the mssql-deployment.yaml file.
This file configures the SQL Server deployment. On line 18, the Microsoft SQL Server image
is specified.
Note: The environment variables start at line 21 and continue through 32. These variables accept
the license agreement, set the password for the SA account using a Kubernetes secret, and specify
the paths required by the database.
Starting at line 34, the volumes from the previous file are used.
6. Select the mssql-service.yaml file.
The service provides access to the database. In this case, the service is type LoadBalancer.
Note: A load balancer will create a public IP address, which makes the database available outside
the cluster. If you removed the last line, the service would have only a private IP address, thus
making the database available only from within the cluster.
7. To return to the command line, click Open Terminal.
8. To create the Kubernetes secret that is used to set the password, enter the following
command:
kubectl create secret generic mssql-secrets --from-literal=SA_PASSWORD="Passw0rd!"
Se copió correctamente
content_copy
Note: If the password isn't strong, the deployment will fail when you set the password for
the sa account.
9. To deploy the database, enter the following commands:
kubectl apply -f volume-claims.yaml
kubectl apply -f mssql-deployment.yaml
kubectl apply -f mssql-service.yaml
Se copió correctamente
content_copy
10.Wait a minute for the deployment to succeed, and then type the following command to see
whether the database is ready:
kubectl get pods
Se copió correctamente
content_copy
11.If the status is Running, continue; otherwise, wait a few seconds and run the previous
command again.
12.To get the IP address of the load balancer, enter the following command:
kubectl get services
Se copió correctamente
content_copy
13.If the status of the external IP address of the load balancer is Pending, wait a few seconds
and try again; otherwise, copy the external IP address to the clipboard and paste it in a text
file. (You will need it later.) 34.46.188.22
Click Check my progress to verify the objective.
Configure and deploy SQL Server into the cluster
Revisar mi progreso
Task 3. Connect to the SQL Server database from a client machine
You now create a virtual machine and connect to the SQL Server database running in the GKE
cluster.
1. In the Cloud console, on the Navigation menu (☰), click Compute Engine > VM
Instances.
2. To create a new instance, click Create instance.
3. On the Machine configuration page, enter the following values:
 Name: sql-server-client
 Region: REGION
 Zone: ZONE
4. Click OS and storage.
Click Change to begin configuring your boot disk and select the values for:
 Operating system: Container Optimized OS
 Version: Accept the default version
Click on Select.
5. Once all sections are configured, scroll down and click Create to launch your virtual
machine instance.
Click Check my progress to verify the objective.
Connect to the SQL Server database from a client machine
Revisar mi progreso
6. When the machine is ready, click SSH to connect to it.
You now run a Docker container provided by Microsoft that has the SQL client tools already
installed.
7. To start the container in interactive mode, enter the following command:
sudo docker run -it mcr.microsoft.com/mssql-tools
Se copió correctamente
content_copy
It will take a few seconds for the container to be downloaded and executed.
8. To connect to your SQL Server database running inside the GKE cluster, enter the following
command at the prompt, changing the <IP-address> to your load balancer's IP address:
sqlcmd -S <IP-address> -U sa -P Passw0rd!
Se copió correctamente
content_copy
9. Test your connection:
EXEC sp_databases;
Se copió correctamente
content_copy
GO
Se copió correctamente
content_copy
10.Exit from the client, close the SSH window, and return to Cloud Shell.
11.To delete the SQL Server deployment, enter the following commands:
kubectl delete -f mssql-service.yaml
kubectl delete -f mssql-deployment.yaml
kubectl delete -f volume-claims.yaml
kubectl delete secrets/mssql-secrets
Se copió correctamente
content_copy
Congratulations! You have created a Kubernetes cluster in Google Kubernetes Engine. You
configured and deployed a Microsoft SQL Server database into the cluster and connected to it from
a client machine.
End your lab
When you have completed your lab, click End Lab. Google Cloud Skills Boost removes the
resources you’ve used and cleans the account for you.
You will be given an opportunity to rate the lab experience. Select the applicable number of stars,
type a comment, and then click Submit.
The number of stars indicates the following:
 1 star = Very dissatisfied
 2 stars = Dissatisfied
 3 stars = Neutral
 4 stars = Satisfied
 5 stars = Very satisfied
You can close the dialog box if you don't want to provide feedback.
For feedback, suggestions, or corrections, please use the Support tab.
Copyright 2022 Google LLC All rights reserved. Google and the Google logo are trademarks of
Google LLC. All other company and product names may be trademarks of the respective
companies with which they are associated.
navigate_beforeAnterior
Siguientenavigate_next

Before you begin


1. Labs create a Google Cloud project and resources for a fixed time
2. Labs have a time limit and no pause feature. If you end the lab, you'll have to restart from
the beginning.
3. On the top left of your screen, click Start lab to begin
Skip
Finish
task_alt
Detalles de puntuación
Aceptar
Este contenido no está disponible en este momento
Te enviaremos una notificación por correo electrónico cuando esté disponible
No, gracias
Sí, notificarme

¡Genial!
Nos comunicaremos contigo por correo electrónico si está disponible
Volver a la pantalla
Got it

One lab at a time


Confirm to end all existing labs and start this one
Cancel
Confirm
Cancel
¿Cuál es su grado de satisfacción con este lab?*
Cancelar
Enviar
error_outline
¿Confirmas la acción? Es posible que no puedas reiniciar el lab y, si lo haces, deberás comenzar
desde el principio.
Cancelar
Finalizar lab
error
Hay una nueva versión disponible de este curso. Se transferirá el progreso si decides actualizar. Sin
embargo, tu porcentaje de finalización puede cambiar si la nueva versión agrega o quita
actividades de aprendizaje. Haz clic en el botón de vista previa para ver los cambios del curso
antes de actualizar.
Cancelar
Vista previa

You might also like