Google Professional Cloud Developer Question 400
Select 3Google Cloud PlatformYou are developing a cloud-native application that needs to connect to a Cloud SQL database. The application will run on Google Kubernetes Engine (GKE). To ensure secure and efficient connections to the database, which of the following steps should you take?
- A
Use the Cloud SQL Auth Proxy to handle authentication and connection management.
- B
Store the database credentials in Kubernetes Secrets and manually use them to establish a connection.
- C
Enable private IP for the Cloud SQL instance and ensure the GKE cluster is in the same VPC network.
- D
Use a public IP address for the Cloud SQL instance and allow access from all IP addresses for simplicity.
- E
Scale the number of database connections dynamically by enabling connection pooling.
Show answer and explanation
Correct answers: A, C, E
Explanation
To securely and efficiently manage connections to a Cloud SQL database, it is recommended to use the Cloud SQL Auth Proxy for authentication and connection management. Enabling private IP ensures secure communication within the VPC network, while connection pooling optimizes the number of database connections. Avoid exposing the database to public IPs or relying solely on Kubernetes Secrets for authentication.
- A. Correct.
Correct. The Cloud SQL Auth Proxy simplifies authentication and ensures that credentials are not exposed. It also handles connection management securely.
- B. Incorrect.
Incorrect. While Kubernetes Secrets provide some level of security, manually managing database credentials increases the risk of misconfigurations and security breaches.
- C. Correct.
Correct. Enabling private IP improves security by keeping traffic within the VPC network, and placing the GKE cluster in the same VPC ensures low latency and secure connectivity.
- D. Incorrect.
Incorrect. Using public IPs and allowing access from all IPs significantly increases the attack surface and is not recommended for production environments.
- E. Correct.
Correct. Connection pooling helps optimize the number of database connections, reducing resource contention and improving application performance.