How Do You Open a Port to Connect to a GCP server?

Problem scenario
You are used to AWS Security Groups. You created a firewall rule in GCP. You cannot seem to reach the GCP server. What is wrong?

Possible Solution
Does the GCP firewall rule use the same shorthand notation like this?
x.x.x.x/32

Inbound rules in AWS Security Groups use the /32 to allow an IP address to connect to an EC-2 instance or service.

 » Read more..

How Do You Create a Windows VM in Google Cloud Platform with the Console?

Problem scenario
You want to create a Windows server in Google Cloud Platform. How do you do this?

Solution
1. Log into Google Cloud Platform.
2. Click the hamburger icon in the upper left hand corner (the icon with three horizontal bars stacked onto each other).
3. Go to Compute Engine -VM Instances
4. Click “Create Instance”
5.

 » Read more..

How Do You Troubleshoot a Web Server in GCP Not Working via a Web Browser when Port 80 Is Not Blocked?

Problem scenario
From a web browser these commands succeed (where x.x.x.x is the external IP address of the Linux VM serving the web service):

Test-NetConnection -ComputerName x.x.x.x -Port 80
Test-NetConnection -ComputerName x.x.x.x -Port 443

But when you open a web browser and go to the x.x.x.x IP address, but the page does not load. You may get an error message about it timing out or not being reached or available.

 » Read more..

How Do You Troubleshoot the Message “ImportError: cannot import name ‘pubsub_v1′”?

Problem scenario
From the Python command prompt or when running a Python program, you receive this message “ImportError: cannot import name ‘pubsub_v1′”. What should you do?

Solution
Possible Solution #1
Try to run the program as sudo: sudo python nameOfProg.py

Possible Solution #2
Prerequisite
This assumes that pip has been installed.

 » Read more..

How Do You Troubleshoot the Message “ImportError: No module named ‘google'”?

Problem scenario
From the Python command prompt or when running a Python program, you receive this message “ImportError: No module named ‘google'”. What should you do?

Solution
Possible Solution #1
Try to run the program as sudo: sudo python nameOfProg.py

Possible Solution #2
Prerequisite
This assumes that pip has been installed.

 » Read more..

How Do You Use Terraform to Create a Server in GCP?

Problem scenario
You want to use infrastructure as a code with Terraform and GCP. How do you use a .tf file to create a virtual machine in Google Cloud Platform?

Solution
Prerequisite

This assumes you have installed Terraform. If you need assistance with this, see this posting.

Procedures

1. Obtain the account.json file for your GCP account.

 » Read more..

How Do You Delete VM Instances from GCP That Pertain to GKE?

Problem Scenario
You have some GKE standard clusters that you want deleted. You try to delete them, but they do not go away. What should you do?

Solution
Root cause: Kubernetes clusters are self-healing. They are acting as they were designed. Once the instance group is deleted, you will be able to delete the instances via the web UI or via Google’s Cloud Shell.

 » Read more..

How Do You Install Docker on Debian Linux in GCP?

Problem scneario
In Google Cloud Platform you have a Debian Linux server. You want to install Docker on it. What do you do?

Solution
1. Create a file called dockerinstall.sh in the /tmp/ directory with the following content:

apt-get -y update
apt-get install -y apt-transport-https ca-certificates wget software-properties-common

wget https://download.docker.com/linux/debian/gpg
apt-key add gpg

echo “deb [arch=amd64] https://download.docker.com/linux/debian $(lsb_release -cs) stable” | sudo tee -a /etc/apt/sources.list.d/docker.list
apt-get -y update

apt-get -y install docker-ce

2.

 » Read more..

How Do You Troubleshoot the Google Kubernetes Engine error “Request had insufficient authentication scopes”?

Problem scenario
You run a command like this:
gcloud container clusters get-credentials standard-cluster-1 –region us-central1-a

But you receive this message:
“Fetching cluster endpoint and auth data.
ERROR: (gcloud.container.clusters.get-credentials) ResponseError: code=403, message=Request had insufficient authentication scopes.”

What should you do?

Solution
1. Stop the VM.
2. Click on the hyperlinked name of the VM.
3.

 » Read more..

How Do You Troubleshoot This Error “error executing access token command /google/google-cloud-sdk/bin/gcloud”?

Problem scenario
You run a command like this to view your Google Kubernetes Engine (GKE) clusters:

kubectl get pods

You see this:
‘Unable to connect to the server: error executing access token command “/google/google-cloud-sdk/bin/gcloud config config-helper –format=json”: err=fork/exec /google/google-cloud-sdk/bin/gcloud: no such file or directory output= stderr=’

What should you do?

Solution
Check your config file in the .kube directory.

 » Read more..