gcloud auth list
gcloud config list project
gcloud config set compute/region us-west3
gcloud config set compute/zone us-west3-c
#####################################
Task 1. Create a project jumphost instance
#####################################
make manualy
Create a project jumphost instance
gcloud compute instances create nucleus-jumphost-891 --zone us-east1-c --machine-type=f1-micro --image-family=debian-10 --image-project=debian-cloud
######################################
Task 2. Create a Kubernetes service cluster
######################################
Create a zonal cluster using
gcloud container clusters create kuber1 --machine-type=n1-standard-1 --zone=us-west4-a
Use the Docker container hello-app
kubectl create deployment hello-server --image=gcr.io/google-samples/hello-app:2.0
Expose the app on port
kubectl expose deployment hello-server --type=LoadBalancer --port 8080
Task 3: Setup an HTTP load balancer
Command-5)
cat << EOF > startup.sh
#! /bin/bash
apt-get update
apt-get install -y nginx
service nginx start
sed -i -- 's/nginx/Google Cloud Platform - '""\$HOSTNAME""'/' /var/www/html/index.nginx-debian.html
EOF
Create an instance template :
Command-6)
gcloud compute instance-templates create web-server-template \
--metadata-from-file startup-script=startup.sh \
--network nucleus-vpc \
--machine-type g1-small \
--region us-west3-b
(Important Note:-Replace us-west3-b with your zone mentioned in lab instructions)
Create a target pool :
Command-7)
gcloud compute target-pools create nginx-pool
Create a managed instance group :
Command-8)
gcloud compute instance-groups managed create web-server-group \
--base-instance-name web-server \
--size 2 \
--template web-server-template \
--region us-west3
(Important Note:-Replace us-west3 with your zone mentioned in lab instructions)
Create a firewall rule to allow traffic (80/tcp) :
Command-9)
gcloud compute firewall-rules create accept-tcp-rule-279 \
--allow tcp:80 \
--network nucleus-vpc
(Important Note:- Replace accept-tcp-rule-279 with the rule appears in your lab instructions)
Create a health check :
Command-10)
gcloud compute http-health-checks create http-basic-check
Command-11)
gcloud compute instance-groups managed \
set-named-ports web-server-group \
--named-ports http:80 \
--region us-west3
(Important Note:-Replace us-west3 with your zone mentioned in lab instructions)
Create a backend service and attach the managed instance group :
Command-12)
gcloud compute backend-services create web-server-backend \
--protocol HTTP \
--http-health-checks http-basic-check \
--global
Command-13)
gcloud compute backend-services add-backend web-server-backend \
--instance-group web-server-group \
--instance-group-region us-west3 \
--global
(Important Note:-Replace us-west3 with your zone mentioned in lab instructions)
Create a URL map and target HTTP proxy to route requests to your URL map :
Command-14)
gcloud compute url-maps create web-server-map \
--default-service web-server-backend
Command-16)
gcloud compute target-http-proxies create http-lb-proxy \
--url-map web-server-map
Create a forwarding rule :
Command-17)
gcloud compute forwarding-rules create http-content-rule \
--global \
--target-http-proxy http-lb-proxy \
--ports 80
Command-18)
gcloud compute forwarding-rules create accept-tcp-rule-279 \
--global \
--target-http-proxy http-lb-proxy \
--ports 80
gcloud compute forwarding-rules list
(Important Note:- Replace accept-tcp-rule-279 with the rule appears in your lab instructions)
Немає коментарів:
Дописати коментар