<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Anchit Nishant on Medium]]></title>
        <description><![CDATA[Stories by Anchit Nishant on Medium]]></description>
        <link>https://medium.com/@anchitn_19522?source=rss-2d47f7f3f8e2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*1pakA-J3X9k1fqy-</url>
            <title>Stories by Anchit Nishant on Medium</title>
            <link>https://medium.com/@anchitn_19522?source=rss-2d47f7f3f8e2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 17:16:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@anchitn_19522/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Google Cloud Anthos Series: Anthos Multi-cloud & Hybrid story]]></title>
            <link>https://medium.com/google-cloud/google-cloud-anthos-series-anthos-multi-cloud-hybrid-story-fc70ce352c40?source=rss-2d47f7f3f8e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/fc70ce352c40</guid>
            <category><![CDATA[anthos]]></category>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[hybrid]]></category>
            <category><![CDATA[google-cloud]]></category>
            <category><![CDATA[gke]]></category>
            <dc:creator><![CDATA[Anchit Nishant]]></dc:creator>
            <pubDate>Mon, 04 Apr 2022 17:35:32 GMT</pubDate>
            <atom:updated>2022-04-04T17:35:32.855Z</atom:updated>
            <content:encoded><![CDATA[<h4>Google Cloud Anthos Series (Deploy Anthos on AWS) : <strong>Part 9</strong></h4><p>Welcome to Part-9 of the ‘Google Cloud Anthos series’. You can find the complete series <a href="https://medium.com/google-cloud/google-cloud-anthos-series-23b9a35e9179">Here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*owLFjtUfo3J-aXHR9Y2SWg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h1D_l8-q8fM3MFJeeaStAQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Fl7e5UiPVrg7-5FEcoqHZg.png" /></figure><p>With Anthos clusters, you can deploy workloads to multiple clouds with a unified management, signaling, and configuration control plane.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RClLakB1ar6YuECwEWPpNw.png" /></figure><p>In this example we will deploy a Kubernetes cluster on AWS through Anthos.</p><p>Install and configure the below components as a prerequisite:</p><blockquote><a href="https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html">AWS cli</a> <br><a href="https://cloud.google.com/sdk/docs/install">GCloud cli</a><br> <a href="https://stedolan.github.io/jq/download/">jq</a> <br><a href="https://kubernetes.io/docs/tasks/tools/">Kubectl</a></blockquote><p>The AWS region we will use here is us-west-2<br>The GCP region we will use here is us-west1</p><p><strong>Set up some environment variables</strong></p><pre>PROJECT_ID=&quot;&lt;your-gcp-project-id&gt;&quot;</pre><pre>AWS_REGION=&quot;us-west-2&quot;</pre><pre>GCP_REGION=&quot;us-west1&quot;</pre><pre>gcloud components update</pre><p><strong>Enable the below APIs</strong></p><pre>gcloud services enable gkemulticloud.googleapis.com<br>gcloud services enable gkeconnect.googleapis.com<br>gcloud services enable connectgateway.googleapis.com<br>gcloud services enable cloudresourcemanager.googleapis.com<br>gcloud services enable anthos.googleapis.com<br>gcloud services enable logging.googleapis.com<br>gcloud services enable monitoring.googleapis.com</pre><p><strong>Let us create a VPC in AWS with Public and Private Subnets in different AZs.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*w2a2hxYENzu5cugW8o3ImQ.png" /></figure><pre>aws --region $AWS_REGION ec2 create-vpc \<br>    --cidr-block 10.0.0.0/16 \<br>    --tag-specifications &#39;ResourceType=vpc, Tags=[{Key=Name,Value=anthosAWSVPC}]&#39;</pre><pre>VPC_ID=$(aws ec2 describe-vpcs \<br>  --filters &#39;Name=tag:Name,Values=anthosAWSVPC&#39; \<br>  --query &quot;Vpcs[].VpcId&quot; --output text)</pre><pre>aws ec2 modify-vpc-attribute --enable-dns-hostnames --vpc-id $VPC_ID<br>aws ec2 modify-vpc-attribute --enable-dns-support --vpc-id $VPC_ID</pre><p><strong>Create Private and Public Subnets</strong></p><pre>aws ec2 create-subnet \<br>     --availability-zone us-west-2a \<br>     --vpc-id $VPC_ID \<br>     --cidr-block 10.0.1.0/24 \<br>     --tag-specifications &#39;ResourceType=subnet, Tags=[{Key=Name,Value=anthosAWSPrivateSubnet1}]&#39;<br>   aws ec2 create-subnet \<br>     --availability-zone us-west-2b \<br>     --vpc-id $VPC_ID \<br>     --cidr-block 10.0.2.0/24 \<br>     --tag-specifications &#39;ResourceType=subnet, Tags=[{Key=Name,Value=anthosAWSPrivateSubnet2}]&#39;<br>   aws ec2 create-subnet \<br>     --availability-zone us-west-2c \<br>     --vpc-id $VPC_ID \<br>     --cidr-block 10.0.3.0/24 \<br>     --tag-specifications &#39;ResourceType=subnet, Tags=[{Key=Name,Value=anthosAWSPrivateSubnet3}]&#39;</pre><pre>aws ec2 create-subnet \<br>  --availability-zone us-west-2a \<br>  --vpc-id $VPC_ID \<br>  --cidr-block 10.0.101.0/24 \<br>  --tag-specifications &#39;ResourceType=subnet, Tags=[{Key=Name,Value=anthosAWSPublicSubnet1}]&#39;<br>aws ec2 create-subnet \<br>  --availability-zone us-west-2b \<br>  --vpc-id $VPC_ID \<br>  --cidr-block 10.0.102.0/24 \<br>  --tag-specifications &#39;ResourceType=subnet, Tags=[{Key=Name,Value=anthosAWSPublicSubnet2}]&#39;<br>aws ec2 create-subnet \<br>  --availability-zone us-west-2c \<br>  --vpc-id $VPC_ID \<br>  --cidr-block 10.0.103.0/24 \<br>  --tag-specifications &#39;ResourceType=subnet, Tags=[{Key=Name,Value=anthosAWSPublicSubnet3}]&#39;</pre><p><strong>Mark Subnets as public</strong></p><pre>PUBLIC_SUBNET_ID_1=$(aws ec2 describe-subnets \<br>  --filters &#39;Name=tag:Name,Values=anthosAWSPublicSubnet1&#39; \<br>  --query &quot;Subnets[].SubnetId&quot; --output text)<br>PUBLIC_SUBNET_ID_2=$(aws ec2 describe-subnets \<br>  --filters &#39;Name=tag:Name,Values=anthosAWSPublicSubnet2&#39; \<br>  --query &quot;Subnets[].SubnetId&quot; --output text)<br>PUBLIC_SUBNET_ID_3=$(aws ec2 describe-subnets \<br>  --filters &#39;Name=tag:Name,Values=anthosAWSPublicSubnet3&#39; \<br>  --query &quot;Subnets[].SubnetId&quot; --output text)<br>aws ec2 modify-subnet-attribute \<br>  --map-public-ip-on-launch \<br>  --subnet-id $PUBLIC_SUBNET_ID_1<br>aws ec2 modify-subnet-attribute \<br>  --map-public-ip-on-launch \<br>  --subnet-id $PUBLIC_SUBNET_ID_2<br>aws ec2 modify-subnet-attribute \<br>  --map-public-ip-on-launch \<br>  --subnet-id $PUBLIC_SUBNET_ID_3</pre><p><strong>Create Internet Gateway</strong></p><pre>aws --region $AWS_REGION  ec2 create-internet-gateway \<br>  --tag-specifications &#39;ResourceType=internet-gateway, Tags=[{Key=Name,Value=anthosAWSInternetGateway}]&#39;</pre><pre>INTERNET_GW_ID=$(aws ec2 describe-internet-gateways \<br>  --filters &#39;Name=tag:Name,Values=anthosAWSInternetGateway&#39; \<br>  --query &quot;InternetGateways[].InternetGatewayId&quot; --output text)</pre><pre>aws ec2 attach-internet-gateway \<br>  --internet-gateway-id $INTERNET_GW_ID \<br>  --vpc-id $VPC_ID</pre><p><strong>Configure Route Tables for Public Subnets</strong></p><pre>aws ec2 create-route-table --vpc-id $VPC_ID \<br>  --tag-specifications &#39;ResourceType=route-table, Tags=[{Key=Name,Value=anthosAWSPublicRouteTbl1}]&#39;<br>aws ec2 create-route-table --vpc-id $VPC_ID \<br>  --tag-specifications &#39;ResourceType=route-table, Tags=[{Key=Name,Value=anthosAWSPublicRouteTbl2}]&#39;<br>aws ec2 create-route-table --vpc-id $VPC_ID \<br>  --tag-specifications &#39;ResourceType=route-table, Tags=[{Key=Name,Value=anthosAWSPublicRouteTbl3}]&#39;</pre><pre>PUBLIC_ROUTE_TABLE_ID_1=$(aws ec2 describe-route-tables \<br>    --filters &#39;Name=tag:Name,Values=anthosAWSPublicRouteTbl1&#39; \<br>    --query &quot;RouteTables[].RouteTableId&quot; --output text)<br>PUBLIC_ROUTE_TABLE_ID_2=$(aws ec2 describe-route-tables \<br>    --filters &#39;Name=tag:Name,Values=anthosAWSPublicRouteTbl2&#39; \<br>    --query &quot;RouteTables[].RouteTableId&quot; --output text)<br>PUBLIC_ROUTE_TABLE_ID_3=$(aws ec2 describe-route-tables \<br>    --filters &#39;Name=tag:Name,Values=anthosAWSPublicRouteTbl3&#39; \<br>    --query &quot;RouteTables[].RouteTableId&quot; --output text)<br>aws ec2 associate-route-table \<br>  --route-table-id $PUBLIC_ROUTE_TABLE_ID_1 \<br>  --subnet-id $PUBLIC_SUBNET_ID_1<br>aws ec2 associate-route-table \<br>  --route-table-id $PUBLIC_ROUTE_TABLE_ID_2 \<br>  --subnet-id $PUBLIC_SUBNET_ID_2<br>aws ec2 associate-route-table \<br>  --route-table-id $PUBLIC_ROUTE_TABLE_ID_3 \<br>  --subnet-id $PUBLIC_SUBNET_ID_3</pre><pre>aws ec2 create-route --route-table-id $PUBLIC_ROUTE_TABLE_ID_1 \<br>  --destination-cidr-block 0.0.0.0/0 --gateway-id $INTERNET_GW_ID<br>aws ec2 create-route --route-table-id $PUBLIC_ROUTE_TABLE_ID_2 \<br>  --destination-cidr-block 0.0.0.0/0 --gateway-id $INTERNET_GW_ID<br>aws ec2 create-route --route-table-id $PUBLIC_ROUTE_TABLE_ID_3 \<br>  --destination-cidr-block 0.0.0.0/0 --gateway-id $INTERNET_GW_ID</pre><pre>aws ec2 allocate-address \<br>  --tag-specifications &#39;ResourceType=elastic-ip, Tags=[{Key=Name,Value=anthosAWSNatEip1}]&#39;<br>aws ec2 allocate-address \<br>  --tag-specifications &#39;ResourceType=elastic-ip, Tags=[{Key=Name,Value=anthosAWSNatEip2}]&#39;<br>aws ec2 allocate-address \<br>  --tag-specifications &#39;ResourceType=elastic-ip, Tags=[{Key=Name,Value=anthosAWSNatEip3}]&#39;</pre><p><strong>Create NAT gateway</strong></p><pre>NAT_EIP_ALLOCATION_ID_1=$(aws ec2 describe-addresses \<br>     --filters &#39;Name=tag:Name,Values=anthosAWSNatEip1&#39; \<br>     --query &quot;Addresses[].AllocationId&quot; --output text)<br>   NAT_EIP_ALLOCATION_ID_2=$(aws ec2 describe-addresses \<br>     --filters &#39;Name=tag:Name,Values=anthosAWSNatEip2&#39; \<br>     --query &quot;Addresses[].AllocationId&quot; --output text)<br>   NAT_EIP_ALLOCATION_ID_3=$(aws ec2 describe-addresses \<br>     --filters &#39;Name=tag:Name,Values=anthosAWSNatEip3&#39; \<br>     --query &quot;Addresses[].AllocationId&quot; --output text)<br>   aws ec2 create-nat-gateway \<br>     --allocation-id $NAT_EIP_ALLOCATION_ID_1 \<br>     --subnet-id $PUBLIC_SUBNET_ID_1 \<br>     --tag-specifications &#39;ResourceType=natgateway, Tags=[{Key=Name,Value=anthosAWSNatGateway1}]&#39;<br>   aws ec2 create-nat-gateway \<br>     --allocation-id $NAT_EIP_ALLOCATION_ID_2 \<br>     --subnet-id $PUBLIC_SUBNET_ID_2 \<br>     --tag-specifications &#39;ResourceType=natgateway, Tags=[{Key=Name,Value=anthosAWSNatGateway2}]&#39;<br>   aws ec2 create-nat-gateway \<br>     --allocation-id $NAT_EIP_ALLOCATION_ID_3 \<br>     --subnet-id $PUBLIC_SUBNET_ID_3 \<br>     --tag-specifications &#39;ResourceType=natgateway, Tags=[{Key=Name,Value=anthosAWSNatGateway3}]&#39;</pre><p><strong>Configure route table for Private Subnets</strong></p><pre>aws ec2 create-route-table --vpc-id $VPC_ID \<br>  --tag-specifications &#39;ResourceType=route-table, Tags=[{Key=Name,Value=anthosAWSPrivateRouteTbl1}]&#39;<br>aws ec2 create-route-table --vpc-id $VPC_ID \<br>  --tag-specifications &#39;ResourceType=route-table, Tags=[{Key=Name,Value=anthosAWSPrivateRouteTbl2}]&#39;<br>aws ec2 create-route-table --vpc-id $VPC_ID \<br>  --tag-specifications &#39;ResourceType=route-table, Tags=[{Key=Name,Value=anthosAWSPrivateRouteTbl3}]&#39;</pre><pre>PRIVATE_SUBNET_ID_1=$(aws ec2 describe-subnets \<br>  --filters &#39;Name=tag:Name,Values=anthosAWSPrivateSubnet1&#39; \<br>  --query &quot;Subnets[].SubnetId&quot; --output text)<br>PRIVATE_SUBNET_ID_2=$(aws ec2 describe-subnets \<br>  --filters &#39;Name=tag:Name,Values=anthosAWSPrivateSubnet2&#39; \<br>  --query &quot;Subnets[].SubnetId&quot; --output text)<br>PRIVATE_SUBNET_ID_3=$(aws ec2 describe-subnets \<br>  --filters &#39;Name=tag:Name,Values=anthosAWSPrivateSubnet3&#39; \<br>  --query &quot;Subnets[].SubnetId&quot; --output text)<br>PRIVATE_ROUTE_TABLE_ID_1=$(aws ec2 describe-route-tables \<br>  --filters &#39;Name=tag:Name,Values=anthosAWSPrivateRouteTbl1&#39; \<br>  --query &quot;RouteTables[].RouteTableId&quot; --output text)<br>PRIVATE_ROUTE_TABLE_ID_2=$(aws ec2 describe-route-tables \<br>  --filters &#39;Name=tag:Name,Values=anthosAWSPrivateRouteTbl2&#39; \<br>  --query &quot;RouteTables[].RouteTableId&quot; --output text)<br>PRIVATE_ROUTE_TABLE_ID_3=$(aws ec2 describe-route-tables \<br>  --filters &#39;Name=tag:Name,Values=anthosAWSPrivateRouteTbl3&#39; \<br>  --query &quot;RouteTables[].RouteTableId&quot; --output text)<br>aws ec2 associate-route-table --route-table-id $PRIVATE_ROUTE_TABLE_ID_1 \<br>  --subnet-id $PRIVATE_SUBNET_ID_1<br>aws ec2 associate-route-table --route-table-id $PRIVATE_ROUTE_TABLE_ID_2 \<br>  --subnet-id $PRIVATE_SUBNET_ID_2<br>aws ec2 associate-route-table --route-table-id $PRIVATE_ROUTE_TABLE_ID_3 \<br>  --subnet-id $PRIVATE_SUBNET_ID_3</pre><pre>NAT_GW_ID_1=$(aws ec2 describe-nat-gateways \<br> --filter &#39;Name=tag:Name,Values=anthosAWSNatGateway1&#39; \<br> --query &quot;NatGateways[].NatGatewayId&quot; --output text)<br>NAT_GW_ID_2=$(aws ec2 describe-nat-gateways \<br> --filter &#39;Name=tag:Name,Values=anthosAWSNatGateway2&#39; \<br> --query &quot;NatGateways[].NatGatewayId&quot; --output text)<br>NAT_GW_ID_3=$(aws ec2 describe-nat-gateways \<br> --filter &#39;Name=tag:Name,Values=anthosAWSNatGateway3&#39; \<br> --query &quot;NatGateways[].NatGatewayId&quot; --output text)<br>aws ec2 create-route --route-table-id $PRIVATE_ROUTE_TABLE_ID_1  \<br>  --destination-cidr-block 0.0.0.0/0 --gateway-id $NAT_GW_ID_1<br>aws ec2 create-route --route-table-id $PRIVATE_ROUTE_TABLE_ID_2  \<br>  --destination-cidr-block 0.0.0.0/0 --gateway-id $NAT_GW_ID_2<br>aws ec2 create-route --route-table-id $PRIVATE_ROUTE_TABLE_ID_3 \<br>  --destination-cidr-block 0.0.0.0/0 --gateway-id $NAT_GW_ID_3</pre><p><strong>Tag Subnets for Load balancers</strong></p><pre>aws ec2 create-tags \<br>  --resources $PUBLIC_SUBNET_ID_1 \<br>  --tags Key=kubernetes.io/role/elb,Value=1<br>aws ec2 create-tags \<br>  --resources $PUBLIC_SUBNET_ID_2 \<br>  --tags Key=kubernetes.io/role/elb,Value=1<br>aws ec2 create-tags \<br>  --resources $PUBLIC_SUBNET_ID_3 \<br>  --tags Key=kubernetes.io/role/elb,Value=1</pre><pre>aws ec2 create-tags \<br>  --resources $PRIVATE_SUBNET_ID_1 \<br>  --tags Key=kubernetes.io/role/internal-elb,Value=1<br>aws ec2 create-tags \<br>  --resources $PRIVATE_SUBNET_ID_2 \<br>  --tags Key=kubernetes.io/role/internal-elb,Value=1<br>aws ec2 create-tags \<br>  --resources $PRIVATE_SUBNET_ID_3 \<br>  --tags Key=kubernetes.io/role/internal-elb,Value=1</pre><p><strong>Create KMS Key in AWS</strong></p><pre>AWS_KMS_DATA=$(aws --region $AWS_REGION kms create-key \<br>    --description &quot;kms_key&quot;)</pre><pre>AWS_KMS_ARN=$(echo $AWS_KMS_DATA | jq .KeyMetadata.Arn -r)</pre><p><strong>Create IAM policies and roles</strong></p><pre>PROJECT_ID=&quot;$(gcloud config get-value project)&quot;</pre><pre>PROJECT_NUMBER=$(gcloud projects describe &quot;$PROJECT_ID&quot; \<br>  --format &quot;value(projectNumber)&quot;)<br><br>aws iam create-role --role-name ANTHOS_API_ROLE \<br>  --assume-role-policy-document &#39;{<br>  &quot;Version&quot;: &quot;2012-10-17&quot;,<br>  &quot;Statement&quot;: [<br>    {<br>      &quot;Sid&quot;: &quot;&quot;,<br>      &quot;Effect&quot;: &quot;Allow&quot;,<br>      &quot;Principal&quot;: {<br>        &quot;Federated&quot;: &quot;accounts.google.com&quot;<br>      },<br>      &quot;Action&quot;: &quot;sts:AssumeRoleWithWebIdentity&quot;,<br>      &quot;Condition&quot;: {<br>        &quot;StringEquals&quot;: {<br>          &quot;accounts.google.com:sub&quot;: &quot;service-&#39;$PROJECT_NUMBER&#39;@gcp-sa-gkemulticloud.iam.gserviceaccount.com&quot;<br>        }<br>      }<br>    }<br>  ]<br>}&#39;</pre><pre>ANTHOS_API_ROLE_ARN=$(aws iam get-role --role-name &quot;ANTHOS_API_ROLE&quot; --query &quot;Role.Arn&quot; --output text)</pre><pre>aws iam create-policy --policy-name ANTHOS_API_POLICY \<br>    --policy-document &#39;{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Sid&quot;: &quot;&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;kms:Encrypt&quot;,<br>                &quot;kms:DescribeKey&quot;,<br>                &quot;iam:CreateServiceLinkedRole&quot;,<br>                &quot;iam:PassRole&quot;,<br>                &quot;elasticloadbalancing:DescribeTargetHealth&quot;,<br>                &quot;elasticloadbalancing:DescribeTargetGroups&quot;,<br>                &quot;elasticloadbalancing:DescribeLoadBalancers&quot;,<br>                &quot;elasticloadbalancing:DescribeListeners&quot;,<br>                &quot;elasticloadbalancing:DeleteTargetGroup&quot;,<br>                &quot;elasticloadbalancing:DeleteLoadBalancer&quot;,<br>                &quot;elasticloadbalancing:DeleteListener&quot;,<br>                &quot;elasticloadbalancing:CreateTargetGroup&quot;,<br>                &quot;elasticloadbalancing:CreateLoadBalancer&quot;,<br>                &quot;elasticloadbalancing:CreateListener&quot;,<br>                &quot;elasticloadbalancing:AddTags&quot;,<br>                &quot;elasticloadbalancing:ModifyTargetGroupAttributes&quot;,<br>                &quot;ec2:ModifyNetworkInterfaceAttribute&quot;,<br>                &quot;ec2:DescribeAccountAttributes&quot;,<br>                &quot;ec2:DescribeInternetGateways&quot;,<br>                &quot;ec2:RunInstances&quot;,<br>                &quot;ec2:RevokeSecurityGroupIngress&quot;,<br>                &quot;ec2:RevokeSecurityGroupEgress&quot;,<br>                &quot;ec2:DescribeVpcs&quot;,<br>                &quot;ec2:DescribeVolumes&quot;,<br>                &quot;ec2:DescribeSubnets&quot;,<br>                &quot;ec2:DescribeSecurityGroups&quot;,<br>                &quot;ec2:DescribeNetworkInterfaces&quot;,<br>                &quot;ec2:DescribeLaunchTemplates&quot;,<br>                &quot;ec2:DescribeKeyPairs&quot;,<br>                &quot;ec2:DeleteVolume&quot;,<br>                &quot;ec2:DeleteTags&quot;,<br>                &quot;ec2:DeleteSecurityGroup&quot;,<br>                &quot;ec2:DeleteNetworkInterface&quot;,<br>                &quot;ec2:DeleteLaunchTemplate&quot;,<br>                &quot;ec2:CreateVolume&quot;,<br>                &quot;ec2:CreateTags&quot;,<br>                &quot;ec2:CreateSecurityGroup&quot;,<br>                &quot;ec2:CreateNetworkInterface&quot;,<br>                &quot;ec2:CreateLaunchTemplate&quot;,<br>                &quot;ec2:AuthorizeSecurityGroupIngress&quot;,<br>                &quot;ec2:AuthorizeSecurityGroupEgress&quot;,<br>                &quot;autoscaling:UpdateAutoScalingGroup&quot;,<br>                &quot;autoscaling:TerminateInstanceInAutoScalingGroup&quot;,<br>                &quot;autoscaling:DescribeAutoScalingGroups&quot;,<br>                &quot;autoscaling:DeleteTags&quot;,<br>                &quot;autoscaling:DeleteAutoScalingGroup&quot;,<br>                &quot;autoscaling:CreateOrUpdateTags&quot;,<br>                &quot;autoscaling:CreateAutoScalingGroup&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;*&quot;<br>        }<br>    ]<br>}&#39;</pre><pre>ANTHOS_API_POLICY_ARN=arn:aws:iam::$(aws sts get-caller-identity | jq .Account -r):policy/ANTHOS_API_POLICY</pre><pre>aws iam attach-role-policy \<br> --policy-arn $ANTHOS_API_POLICY_ARN \<br> --role-name ANTHOS_API_ROLE</pre><pre>aws iam create-role --role-name ANTHOS_CONTROL_PLANE_ROLE \<br>  --assume-role-policy-document &#39;{<br>  &quot;Version&quot;: &quot;2012-10-17&quot;,<br>  &quot;Statement&quot;: [<br>    {<br>      &quot;Sid&quot;: &quot;&quot;,<br>      &quot;Effect&quot;: &quot;Allow&quot;,<br>      &quot;Principal&quot;: {<br>        &quot;Service&quot;: &quot;ec2.amazonaws.com&quot;<br>      },<br>      &quot;Action&quot;: &quot;sts:AssumeRole&quot;<br>    }<br>  ]<br>}&#39;</pre><pre>aws iam create-policy --policy-name ANTHOS_CONTROL_PLANE_POLICY \<br>    --policy-document &#39;{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Sid&quot;: &quot;&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;kms:Encrypt&quot;,<br>                &quot;kms:Decrypt&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;&#39;&quot;$AWS_KMS_ARN&quot;&#39;&quot;<br>        },<br>        {<br>            &quot;Sid&quot;: &quot;&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;iam:CreateServiceLinkedRole&quot;,<br>                &quot;elasticloadbalancing:SetLoadBalancerPoliciesOfListener&quot;,<br>                &quot;elasticloadbalancing:SetLoadBalancerPoliciesForBackendServer&quot;,<br>                &quot;elasticloadbalancing:RegisterTargets&quot;,<br>                &quot;elasticloadbalancing:RegisterInstancesWithLoadBalancer&quot;,<br>                &quot;elasticloadbalancing:ModifyTargetGroup&quot;,<br>                &quot;elasticloadbalancing:ModifyLoadBalancerAttributes&quot;,<br>                &quot;elasticloadbalancing:ModifyListener&quot;,<br>                &quot;elasticloadbalancing:DetachLoadBalancerFromSubnets&quot;,<br>                &quot;elasticloadbalancing:DescribeTargetHealth&quot;,<br>                &quot;elasticloadbalancing:DescribeTargetGroups&quot;,<br>                &quot;elasticloadbalancing:DescribeLoadBalancers&quot;,<br>                &quot;elasticloadbalancing:DescribeLoadBalancerPolicies&quot;,<br>                &quot;elasticloadbalancing:DescribeLoadBalancerAttributes&quot;,<br>                &quot;elasticloadbalancing:DescribeListeners&quot;,<br>                &quot;elasticloadbalancing:DeregisterTargets&quot;,<br>                &quot;elasticloadbalancing:DeregisterInstancesFromLoadBalancer&quot;,<br>                &quot;elasticloadbalancing:DeleteTargetGroup&quot;,<br>                &quot;elasticloadbalancing:DeleteLoadBalancerListeners&quot;,<br>                &quot;elasticloadbalancing:DeleteLoadBalancer&quot;,<br>                &quot;elasticloadbalancing:DeleteListener&quot;,<br>                &quot;elasticloadbalancing:CreateTargetGroup&quot;,<br>                &quot;elasticloadbalancing:CreateLoadBalancerPolicy&quot;,<br>                &quot;elasticloadbalancing:CreateLoadBalancerListeners&quot;,<br>                &quot;elasticloadbalancing:CreateLoadBalancer&quot;,<br>                &quot;elasticloadbalancing:CreateListener&quot;,<br>                &quot;elasticloadbalancing:ConfigureHealthCheck&quot;,<br>                &quot;elasticloadbalancing:AttachLoadBalancerToSubnets&quot;,<br>                &quot;elasticloadbalancing:ApplySecurityGroupsToLoadBalancer&quot;,<br>                &quot;elasticloadbalancing:AddTags&quot;,<br>                &quot;ec2:RevokeSecurityGroupIngress&quot;,<br>                &quot;ec2:ModifyVolume&quot;,<br>                &quot;ec2:ModifyInstanceAttribute&quot;,<br>                &quot;ec2:DetachVolume&quot;,<br>                &quot;ec2:DescribeDhcpOptions&quot;,<br>                &quot;ec2:DescribeVpcs&quot;,<br>                &quot;ec2:DescribeVolumesModifications&quot;,<br>                &quot;ec2:DescribeVolumes&quot;,<br>                &quot;ec2:DescribeTags&quot;,<br>                &quot;ec2:DescribeSubnets&quot;,<br>                &quot;ec2:DescribeSnapshots&quot;,<br>                &quot;ec2:DescribeSecurityGroups&quot;,<br>                &quot;ec2:DescribeRouteTables&quot;,<br>                &quot;ec2:DescribeRegions&quot;,<br>                &quot;ec2:DescribeLaunchTemplateVersions&quot;,<br>                &quot;ec2:DescribeInstances&quot;,<br>                &quot;ec2:DeleteVolume&quot;,<br>                &quot;ec2:DeleteTags&quot;,<br>                &quot;ec2:DeleteSnapshot&quot;,<br>                &quot;ec2:DeleteSecurityGroup&quot;,<br>                &quot;ec2:DeleteRoute&quot;,<br>                &quot;ec2:CreateVolume&quot;,<br>                &quot;ec2:CreateTags&quot;,<br>                &quot;ec2:CreateSnapshot&quot;,<br>                &quot;ec2:CreateSecurityGroup&quot;,<br>                &quot;ec2:CreateRoute&quot;,<br>                &quot;ec2:AuthorizeSecurityGroupIngress&quot;,<br>                &quot;ec2:AttachVolume&quot;,<br>                &quot;ec2:AttachNetworkInterface&quot;,<br>                &quot;autoscaling:TerminateInstanceInAutoScalingGroup&quot;,<br>                &quot;autoscaling:SetDesiredCapacity&quot;,<br>                &quot;autoscaling:DescribeTags&quot;,<br>                &quot;autoscaling:DescribeLaunchConfigurations&quot;,<br>                &quot;autoscaling:DescribeAutoScalingInstances&quot;,<br>                &quot;autoscaling:DescribeAutoScalingGroups&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;*&quot;<br>        }<br>    ]<br>}&#39;</pre><pre>ANTHOS_CONTROL_PLANE_POLICY_ARN=arn:aws:iam::$(aws sts get-caller-identity | jq .Account -r):policy/ANTHOS_CONTROL_PLANE_POLICY</pre><pre>aws iam attach-role-policy \<br>  --policy-arn $ANTHOS_CONTROL_PLANE_POLICY_ARN \<br>  --role-name ANTHOS_CONTROL_PLANE_ROLE</pre><pre>aws iam create-instance-profile \<br>  --instance-profile-name ANTHOS_CONTROL_PLANE_PROFILE</pre><pre>aws iam add-role-to-instance-profile \<br>  --instance-profile-name ANTHOS_CONTROL_PLANE_PROFILE \<br>  --role-name ANTHOS_CONTROL_PLANE_ROLE</pre><pre>aws iam create-role --role-name ANTHOS_NODE_POOL_ROLE \<br>  --assume-role-policy-document &#39;{<br>  &quot;Version&quot;: &quot;2012-10-17&quot;,<br>  &quot;Statement&quot;: [<br>    {<br>      &quot;Sid&quot;: &quot;&quot;,<br>      &quot;Effect&quot;: &quot;Allow&quot;,<br>      &quot;Principal&quot;: {<br>        &quot;Service&quot;: &quot;ec2.amazonaws.com&quot;<br>      },<br>      &quot;Action&quot;: &quot;sts:AssumeRole&quot;<br>    }<br>  ]<br>}&#39;</pre><pre>aws iam create-policy \<br>    --policy-name ANTHOS_NODE_POOL_POLICY \<br>    --policy-document &#39;{<br>    &quot;Version&quot;: &quot;2012-10-17&quot;,<br>    &quot;Statement&quot;: [<br>        {<br>            &quot;Sid&quot;: &quot;&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>                &quot;kms:Encrypt&quot;,<br>                &quot;kms:Decrypt&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;&#39;&quot;$AWS_KMS_ARN&quot;&#39;&quot;<br>        },<br>        {<br>            &quot;Sid&quot;: &quot;&quot;,<br>            &quot;Effect&quot;: &quot;Allow&quot;,<br>            &quot;Action&quot;: [<br>               &quot;autoscaling:DescribeAutoScalingGroups&quot;,<br>               &quot;ec2:AttachNetworkInterface&quot;,<br>               &quot;ec2:DescribeInstances&quot;,<br>               &quot;ec2:DescribeTags&quot;<br>            ],<br>            &quot;Resource&quot;: &quot;*&quot;<br>        }<br>    ]<br>}&#39;</pre><pre>ANTHOS_NODE_POOL_POLICY_ARN=arn:aws:iam::$(aws sts get-caller-identity | jq .Account -r):policy/ANTHOS_NODE_POOL_POLICY</pre><pre>aws iam attach-role-policy --role-name ANTHOS_NODE_POOL_ROLE \<br>  --policy-arn $ANTHOS_NODE_POOL_POLICY_ARN</pre><pre>aws iam create-instance-profile \<br>    --instance-profile-name ANTHOS_NODE_POOL_PROFILE</pre><pre>aws iam add-role-to-instance-profile \<br>  --instance-profile-name ANTHOS_NODE_POOL_PROFILE \<br>  --role-name ANTHOS_NODE_POOL_ROLE</pre><p><strong>Create an EC2 key pair</strong></p><pre>ssh-keygen -t rsa -m PEM -b 4096 -C &quot;$USER&quot; \<br>      -f SSH_PRIVATE_KEY -N &quot;&quot; 1&gt;/dev/null<br><br>aws ec2 import-key-pair --key-name ANTHOS_SSH_KEY_PAIR \<br>      --public-key-material fileb://SSH_PRIVATE_KEY.pub</pre><p><strong>Anthos deployment</strong></p><pre>gcloud config set container_aws/location $AWS_REGION</pre><p><strong>Create a Cluster</strong></p><pre>gcloud container aws clusters create aws-cluster-0 \<br>    --cluster-version 1.21.6-gke.1500 \<br>    --aws-region $AWS_REGION \<br>    --fleet-project $PROJECT_ID \<br>    --vpc-id $VPC_ID \<br>    --subnet-ids $PRIVATE_SUBNET_ID_1,$PRIVATE_SUBNET_ID_2,$PRIVATE_SUBNET_ID_3 \<br>    --pod-address-cidr-blocks 172.31.0.0/20 \<br>    --service-address-cidr-blocks 172.31.32.0/20 \<br>    --role-arn $ANTHOS_API_ROLE_ARN \<br>    --iam-instance-profile ANTHOS_CONTROL_PLANE_PROFILE \<br>    --database-encryption-kms-key-arn $AWS_KMS_ARN \<br>    --config-encryption-kms-key-arn $AWS_KMS_ARN \<br>    --tags &quot;google:gkemulticloud:cluster=aws-cluster-0&quot; \<br>    --location $GCP_REGION</pre><p><strong>Create a node pool</strong></p><pre>gcloud container aws node-pools create pool-0 \<br>    --cluster aws-cluster-0 \<br>    --node-version 1.21.6-gke.1500 \<br>    --min-nodes 1 \<br>    --max-nodes 5 \<br>    --max-pods-per-node 110 \<br>    --root-volume-size 50 \<br>    --subnet-id $PRIVATE_SUBNET_ID_1 \<br>    --iam-instance-profile ANTHOS_NODE_POOL_PROFILE \<br>    --config-encryption-kms-key-arn $AWS_KMS_ARN \<br>    --ssh-ec2-key-pair ANTHOS_SSH_KEY_PAIR \<br>    --tags &quot;google:gkemulticloud:cluster=aws-cluster-0&quot; \<br>    --location $GCP_REGION</pre><p><strong>Get Authentication credentials for your cluster</strong></p><pre>gcloud container aws clusters get-credentials aws-cluster-0 --location $GCP_REGION</pre><p><strong>Clone the Online Boutique repository.</strong></p><pre>git clone <a href="https://github.com/GoogleCloudPlatform/microservices-demo.git">https://github.com/GoogleCloudPlatform/microservices-demo.git</a><br>cd microservices-demo</pre><p><strong>Deploy the Online Boutique application</strong></p><pre>kubectl apply -f ./release/kubernetes-manifests.yaml</pre><p><strong>Check your application through the AWS Load Balancer endpoint</strong></p><pre>kubectl get service frontend-external | awk &#39;{print $4}&#39;</pre><p><strong>Now that we have got the Anthos cluster deployed and registered, we can view it in the GCP console.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gfoXPvKnxJEvfsD1HPLnuw.png" /></figure><p><strong>Login to the cluster</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7j7QdQybsxx9s8vDtIGyzg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ESG_4YPMhRQtbELjdq0wQA.png" /></figure><p><strong>You can explore the Kubernetes engine UI and get all the information on the Cluster.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*f_oZ3ha1B0aJKgFHOuOTFg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4DQdTyULVHY1uEoVjrLgww.png" /></figure><p><strong>Since Anthos uses AWS EC2 for its Control plane and Nodes, you can view them in the AWS console as well.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yj969eeun2F78KwwQKf6Og.png" /></figure><p><strong>Let us install Anthos Service mesh to get a better visibility of microservices.</strong></p><pre>curl https://storage.googleapis.com/csm-artifacts/asm/asmcli_1.12 &gt; asmcli</pre><pre>chmod +x asmcli</pre><pre>KUBECONFIG_LOCATION=$(echo &quot;$HOME/.kube/config&quot;)</pre><pre>./asmcli install \<br>  --fleet_id $PROJECT_ID \<br>  --kubeconfig $KUBECONFIG_LOCATION \<br>  --platform multicloud \<br>  --enable_all \<br>  --ca mesh_ca</pre><pre>kubectl -n istio-system get pods -l app=istiod --show-labels</pre><pre>REV=[rev-label]<br></pre><pre>kubectl label namespace default istio.io/rev=${REV} istio-injection- --overwrite<br></pre><pre>kubectl delete pod -n default --all<br></pre><pre>kubectl get pod -n default</pre><p><strong>You can check the Anthos Service Mesh dashboard which should list all the Services.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TeMFDwe2leDl-O0MDBOPwg.png" /></figure><p><strong>You can use the below commands to delete the cluster to avoid unwanted billing on EC2.</strong></p><pre>gcloud container aws node-pools delete pool-0 --cluster aws-cluster-0 --location $GCP_REGION</pre><pre>gcloud container aws clusters delete aws-cluster-0 --location $GCP_REGION</pre><p>Contributors: <a href="https://medium.com/u/c79cc28e2999">Pushkar Kothavade</a>, <a href="https://medium.com/u/41b475b881ff">Shijimol A K</a>, <a href="https://medium.com/u/71d9487165c6">Dhandus</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fc70ce352c40" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/google-cloud-anthos-series-anthos-multi-cloud-hybrid-story-fc70ce352c40">Google Cloud Anthos Series: Anthos Multi-cloud &amp; Hybrid story</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google Cloud Anthos Series: Anthos Config Management]]></title>
            <link>https://medium.com/google-cloud/google-cloud-anthos-series-part5-a17ce89ddc7a?source=rss-2d47f7f3f8e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/a17ce89ddc7a</guid>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[anthos]]></category>
            <category><![CDATA[gke]]></category>
            <category><![CDATA[kubernetes]]></category>
            <dc:creator><![CDATA[Anchit Nishant]]></dc:creator>
            <pubDate>Mon, 21 Feb 2022 11:04:02 GMT</pubDate>
            <atom:updated>2022-03-22T10:54:33.619Z</atom:updated>
            <content:encoded><![CDATA[<h4>Google Cloud Anthos Series: Part-5</h4><p>Welcome to Part-5 of the ‘Google Cloud Anthos series’. You can find the complete series <a href="https://medium.com/google-cloud/google-cloud-anthos-series-23b9a35e9179">Here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dJlJTr1G3s4HD1sLo-Q3qg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RuJ_R3in60P5Ccj4liU4_A.png" /></figure><p><strong>Set the </strong><strong>PROJECT_ID environment variable and ensure the Google Kubernetes Engine and Cloud Operations APIs are enabled.</strong></p><pre>PROJECT_ID=&quot;&lt;your-project-id&gt;&quot;<br>gcloud services enable container.googleapis.com --project ${PROJECT_ID}<br>gcloud services enable monitoring.googleapis.com \<br>    cloudtrace.googleapis.com \<br>    clouddebugger.googleapis.com \<br>    cloudprofiler.googleapis.com \<br>    --project ${PROJECT_ID}</pre><p><strong>Clone the Online Boutique repository.</strong></p><pre>git clone <a href="https://github.com/GoogleCloudPlatform/microservices-demo.git">https://github.com/GoogleCloudPlatform/microservices-demo.git</a><br>cd microservices-demo</pre><p>Create GKE clusters in three different regions. Make sure you have a VPC which spans across at-least 3 regions where you would want your clusters to reside.</p><pre>ZONE1=us-central1-b<br>ZONE2=europe-west1-b<br>ZONE3=asia-south1-b</pre><pre>gcloud container clusters create us-gke-cluster \<br>    --project=${PROJECT_ID} --zone=${ZONE1} \<br>    --machine-type=e2-standard-2 --num-nodes=4 \<br>    --scopes=cloud-platform \<br>    --workload-pool=${PROJECT_ID}.svc.id.goog</pre><pre>gcloud container clusters create eu-gke-cluster \<br>    --project=${PROJECT_ID} --zone=${ZONE2} \<br>    --machine-type=e2-standard-2 --num-nodes=4 \<br>    --scopes=cloud-platform \<br>    --workload-pool=${PROJECT_ID}.svc.id.goog</pre><pre>gcloud container clusters create asia-gke-cluster \<br>    --project=${PROJECT_ID} --zone=${ZONE3} \<br>    --machine-type=e2-standard-2 --num-nodes=4 \<br>    --scopes=cloud-platform \<br>    --workload-pool=${PROJECT_ID}.svc.id.goog</pre><p>Enable Anthos Config management API</p><pre>gcloud beta container hub config-management enable</pre><p>Create a Cloud Source repository</p><pre>gcloud source repos create &lt;repo name&gt;</pre><p>Make sure the default service account PROJECT_NUMBER-compute@developer.gserviceaccount.com for the cluster has the source.reader access to the repository.</p><pre>PROJECT_NUMBER=$(gcloud projects describe $PROJECT_ID --format=&quot;value(projectNumber)&quot;)</pre><pre>gcloud projects add-iam-policy-binding ${PROJECT_ID} --member serviceAccount:${PROJECT_NUMBER}-compute@developer.gserviceaccount.com --role roles/source.reader</pre><p>Push the Online Boutique application to the newly created cloud source repository.</p><p>Deploy the application to all the clusters.</p><pre>kubectx gke_${PROJECT_ID}_${ZONE1}_us-gke-cluster<br>kubectl apply -f ./release/kubernetes-manifests.yaml</pre><pre>kubectx gke_${PROJECT_ID}_${ZONE2}_eu-gke-cluster<br>kubectl apply -f ./release/kubernetes-manifests.yaml</pre><pre>kubectx gke_${PROJECT_ID}_${ZONE3}_asia-gke-cluster<br>kubectl apply -f ./release/kubernetes-manifests.yaml</pre><p>We need to create constraint and push the file to the cloud source repository.</p><p>Here is a sample constraint which will deny creation of any Privileged containers.</p><p>Folder structure: /allpolicies/policies/policy.yaml (screenshot)</p><pre>#policy.yaml<br>apiVersion: constraints.gatekeeper.sh/v1beta1<br>kind: K8sPSPPrivilegedContainer<br>metadata:<br>  name: psp-privileged-container<br>spec:<br>  match:<br>    excludedNamespaces:<br>    - kube-system<br>    kinds:<br>    - apiGroups:<br>      - &quot;&quot;<br>      kinds:<br>      - Pod</pre><p>Push the policy to the source code repository.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/275/1*74FG78VGUXeVscCZYZ91QA.png" /></figure><p>Install Anthos Config Management and configure the policy controller through the GKE console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UulinrEy2xUwof4b9K63gw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*y-gWBKkI8QZbXXjx7taRHA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JSNyUeXSvqcr9NVjpRNFtg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cqcaltTl6rAhgNBEI5i8ZQ.png" /></figure><p>Get the endpoint of the repository using the below command. We will need it in next step.</p><pre>gcloud source repos list</pre><p>Paste the URL of your Cloud source repository as below and click on Show Advanced options.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*u5gS4MbGvIv0_AZHn0wv8A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p44AtLmHFxv54yeFDdUYgQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_4hKQs54oGUMqDATmnB96w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XP7iiBzzMdAfjB9xQwpgsg.png" /></figure><p>You can verify that Config Sync is syncing this constraint to your GKE clusters.</p><pre>kubectx gke_${PROJECT_ID}_${ZONE1}_us-gke-cluster<br>kubectl get constraint</pre><pre>kubectx gke_${PROJECT_ID}_${ZONE2}_eu-gke-cluster<br>kubectl get constraint</pre><pre>kubectx gke_${PROJECT_ID}_${ZONE3}_asia-gke-cluster<br>kubectl get constraint</pre><p>You should be able to see the output as below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KY3qx_HURvWdXtnFaLyM4Q.png" /></figure><p>Now, let’s create a manifest (privileged.yaml) for pod which has privileged container.</p><pre>#privileged.yaml<br>apiVersion: v1<br>kind: Pod<br>metadata:<br> labels:<br>   app: nginx-privileged<br> name: nginx-privileged-disallowed<br>spec:<br> containers:<br> - image: nginx<br>   name: nginx<br>   securityContext:<br>     privileged: true</pre><p>Try to deploy the manifest which violates the policy to any of the cluster.</p><pre>kubectx gke_${PROJECT_ID}_${ZONE1}_us-gke-cluster</pre><pre>kubectl apply -f privileged.yaml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TVYTJtW0bVZOwGO79EVpfQ.png" /></figure><p>It should fail with the below error.</p><pre>Error from server (Forbidden): error when creating &quot;privileged.yaml&quot;: admission webhook &quot;validation.gatekeeper.sh&quot; denied the request: [psp-privileged-container] Privileged container is not allowed: nginx, securityContext: {&quot;privileged&quot;: true}</pre><p>If we run the constraint in <em>dryrun</em> mode, we can view the violations with the below command in status field.</p><pre>kubectl get K8sPSPPrivilegedContainer psp-privileged-container -o yaml</pre><p><strong>Coming up..</strong></p><p>In this blog we discussed Anthos Config Management. In upcoming blogs we will continue the Samajik’s journey with other Anthos features.</p><p>Contributors: <a href="https://medium.com/u/41b475b881ff">Shijimol A K</a>, <a href="https://medium.com/u/c79cc28e2999">Pushkar Kothavade</a>, <a href="https://medium.com/u/71d9487165c6">Dhandus</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a17ce89ddc7a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/google-cloud-anthos-series-part5-a17ce89ddc7a">Google Cloud Anthos Series: Anthos Config Management</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google Cloud Anthos Series: Anthos Service Mesh]]></title>
            <link>https://medium.com/google-cloud/google-cloud-anthos-series-part4-e23172b61ec9?source=rss-2d47f7f3f8e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/e23172b61ec9</guid>
            <category><![CDATA[kubernetes]]></category>
            <category><![CDATA[anthos]]></category>
            <category><![CDATA[istio]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[anthos-service-mesh]]></category>
            <dc:creator><![CDATA[Anchit Nishant]]></dc:creator>
            <pubDate>Tue, 15 Feb 2022 06:03:19 GMT</pubDate>
            <atom:updated>2022-03-22T10:56:14.434Z</atom:updated>
            <content:encoded><![CDATA[<h4>Google Cloud Anthos Series: <strong>Part-4</strong></h4><p>Welcome to Part-4 of the ‘Google Cloud Anthos series’. You can find the complete series <a href="https://medium.com/google-cloud/google-cloud-anthos-series-23b9a35e9179">Here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c-Yr_6v13ocZE1mYraNgaQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m7aQveYB94z2VBGg-t-d4w.png" /></figure><p>These are the deployment options for containerised workloads while using Anthos Service Mesh.</p><ul><li>In-cluster control plane : With In-Cluster deployment, the Istiod is installed in your own cluster.</li><li>Managed Anthos Service Mesh : With managed Anthos Service Mesh, Google handles upgrades, scaling, and security for you minimizing manual user maintenance.</li></ul><p>For this deployment we will use In-cluster deployment with the same Online Boutique application we have used in our “Google Cloud Devops Series” <a href="https://medium.com/google-cloud/google-cloud-devops-part-1-introduction-to-google-native-devops-process-bfb55be9e3f3">here</a>.</p><p><strong>Set the </strong><strong>PROJECT_ID environment variable and ensure the Google Kubernetes Engine and Cloud Operations APIs are enabled.</strong></p><pre>PROJECT_ID=&quot;&lt;your-project-id&gt;&quot;<br>gcloud services enable container.googleapis.com --project ${PROJECT_ID}<br>gcloud services enable monitoring.googleapis.com \<br>    cloudtrace.googleapis.com \<br>    clouddebugger.googleapis.com \<br>    cloudprofiler.googleapis.com \<br>    --project ${PROJECT_ID}</pre><p><strong>Clone the Online Boutique repository.</strong></p><pre>git clone <a href="https://github.com/GoogleCloudPlatform/microservices-demo.git">https://github.com/GoogleCloudPlatform/microservices-demo.git</a><br>cd microservices-demo</pre><p><strong>Create 3 GKE clusters in three different regions.</strong></p><pre>ZONE1=us-central1-b<br>ZONE2=europe-west1-b<br>ZONE3=asia-south1-b</pre><pre>gcloud container clusters create us-gke-cluster \<br>    --project=${PROJECT_ID} --zone=${ZONE1} \<br>    --machine-type=e2-standard-2 --num-nodes=4 \<br>    --scopes=cloud-platform \<br>    --workload-pool=${PROJECT_ID}.svc.id.goog</pre><pre>gcloud container clusters create eu-gke-cluster \<br>    --project=${PROJECT_ID} --zone=${ZONE2} \<br>    --machine-type=e2-standard-2 --num-nodes=4 \<br>    --scopes=cloud-platform \<br>    --workload-pool=${PROJECT_ID}.svc.id.goog</pre><pre>gcloud container clusters create asia-gke-cluster \<br>    --project=${PROJECT_ID} --zone=${ZONE3} \<br>    --machine-type=e2-standard-2 --num-nodes=4 \<br>    --scopes=cloud-platform \<br>    --workload-pool=${PROJECT_ID}.svc.id.goog</pre><p><strong>Install Anthos Service Mesh in each of these clusters.</strong></p><pre>curl https://storage.googleapis.com/csm-artifacts/asm/asmcli &gt; asmcli</pre><pre>chmod +x asmcli</pre><pre>./asmcli install \<br>  --project_id $PROJECT_ID \<br>  --cluster_name us-gke-cluster \<br>  --cluster_location $ZONE1 \<br>  --enable_all \<br>  --ca mesh_ca</pre><pre>./asmcli install \<br>  --project_id $PROJECT_ID \<br>  --cluster_name eu-gke-cluster \<br>  --cluster_location $ZONE2 \<br>  --enable_all \<br>  --ca mesh_ca</pre><pre>./asmcli install \<br>  --project_id $PROJECT_ID \<br>  --cluster_name asia-gke-cluster \<br>  --cluster_location $ZONE3 \<br>  --enable_all \<br>  --ca mesh_ca</pre><p>There is an optional flag - -fleet_id. Fleets (formerly known as environs) are a Google Cloud concept for logically organizing clusters and other resources, letting you use and manage multi-cluster capabilities and apply consistent policies across your systems. In our case since all the clusters are in same project we do not need to specify the fleet-id.</p><p><strong>When the installation is finished, check that the control plane pods are running.</strong></p><p>The revision label comes afterrev= , create environment variable for rev label value.</p><pre>kubectl -n istio-system get pods -l app=istiod --show-labels</pre><pre>REV=[rev-label]</pre><p><strong>Enable sidecar injection for all the clusters by changing kubectl context using kubectx command.</strong></p><pre>kubectx gke_${PROJECT_ID}_${ZONE1}_us-gke-cluster</pre><pre>kubectl label namespace default istio.io/rev=${REV} istio-injection- --overwrite</pre><pre>kubectx gke_${PROJECT_ID}_${ZONE2}_eu-gke-cluster</pre><pre>kubectl label namespace default istio.io/rev=${REV} istio-injection- --overwrite</pre><pre>kubectx gke_${PROJECT_ID}_${ZONE3}_asia-gke-cluster</pre><pre>kubectl label namespace default istio.io/rev=${REV} istio-injection- --overwrite</pre><p>You can safely ignore the “not found” errors.</p><p><strong>Deploy the application to the clusters.</strong></p><pre>kubectx gke_${PROJECT_ID}_${ZONE1}_us-gke-cluster<br>kubectl apply -f ./release/kubernetes-manifests.yaml</pre><pre>kubectx gke_${PROJECT_ID}_${ZONE2}_eu-gke-cluster<br>kubectl apply -f ./release/kubernetes-manifests.yaml</pre><pre>kubectx gke_${PROJECT_ID}_${ZONE3}_asia-gke-cluster<br>kubectl apply -f ./release/kubernetes-manifests.yaml</pre><p>Wait for the pods to be ready and check there would be two containers in every pod.</p><pre>kubectx gke_${PROJECT_ID}_${ZONE1}_us-gke-cluster<br>kubectl get pods</pre><p><strong>Evaluate service performance using the Anthos Service Mesh dashboard</strong></p><ol><li>In the Console, go to <strong>Navigation menu</strong> &gt; <strong>Anthos</strong> &gt; <strong>Dashboard</strong>.</li><li>Click <strong>Service Mesh</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YRVmGtrrNLoGJ4kY0wqAwA.png" /></figure><p>3. You should be able to view service wise dashboard and get a Topology Metrics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zEPKsX5F9eFt5_KmryYxGg.png" /></figure><p>You can explore the dashboard with different services.</p><p>4. Use the Topology view to better visualize your mesh</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qKxNeq6FqGESKLPmnbQf6g.png" /></figure><p><strong>Coming up..</strong></p><p>In this blog we discussed Anthos Service Mesh. In upcoming blogs we will continue the Samajik’s journey with other Anthos features.</p><p>Contributors: <a href="https://medium.com/u/41b475b881ff">Shijimol A K</a>, <a href="https://medium.com/u/c79cc28e2999">Pushkar Kothavade</a>, <a href="https://medium.com/u/71d9487165c6">Dhandus</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e23172b61ec9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/google-cloud-anthos-series-part4-e23172b61ec9">Google Cloud Anthos Series: Anthos Service Mesh</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Google Cloud DevOps Series: Continuous Integration / Continuous Deployment Workflow (CICD)]]></title>
            <link>https://medium.com/google-cloud/part-4-google-devops-continuous-development-workflow-3feb1ea2227e?source=rss-2d47f7f3f8e2------2</link>
            <guid isPermaLink="false">https://medium.com/p/3feb1ea2227e</guid>
            <category><![CDATA[gcp-security-operations]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[google-cloud-deploy]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <dc:creator><![CDATA[Anchit Nishant]]></dc:creator>
            <pubDate>Fri, 12 Nov 2021 12:40:07 GMT</pubDate>
            <atom:updated>2022-04-08T16:53:52.083Z</atom:updated>
            <content:encoded><![CDATA[<h4>Google Cloud DevOps Series: Part-4</h4><p><strong>Welcome to Part 4 of the Google Cloud DevOps series.. You can find the complete series </strong><a href="https://medium.com/google-cloud/google-cloud-devops-part-1-introduction-to-google-native-devops-process-bfb55be9e3f3"><strong>Here</strong></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kgsR0tG7z5uip0_HZrGkVg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EsbbQg4Qmo0aw3-qaRBDhw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*n4tYgvvMN1cjDWmlLif0oQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KX5KB7Ko3PXPGjWDXKsGJQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hNT25t9vwYkKGSvu9dUyPw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4nkLRVFa25eyw54sj9rOzQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HgotytR4gXeFZdEU0gj8iw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RX9FWnVBWwv4mmdKiFtLDw.png" /></figure><p><strong>Continuous Integration and Continuous Deployment : Hands on Demo</strong></p><p>We have already cloned the Online Boutique application in the <a href="https://medium.com/google-cloud/google-cloud-devops-series-4013adab603b">previous Blog</a>. In this demo we will do Continuous Integration and Continuous Deployment into QA, Staging and Production environments.</p><p><strong>Enable the Google Cloud Deploy, Cloud Build, GKE, and Cloud Storage APIs</strong></p><p><strong>Create a Google Cloud repository and push the application to the Repository.</strong></p><pre>PROJECT_ID=&lt;your project ID&gt;<br>SOURCE_REPO_NAME=&lt;name of repository&gt;</pre><pre>gcloud source repos create $SOURCE_REPO_NAME</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bGSFYZR7BHxWLYfUNmBbeQ.png" /></figure><p><strong>Push the Online boutique application to the newly created repository.</strong></p><p><strong>Create 3 different GKE environments for QA, Staging and Production.</strong></p><pre>REGION=&lt;region name eg. us-central1&gt;</pre><pre>gcloud container clusters create qa-cluster --region=$REGION --scopes=cloud-platform --workload-pool=${PROJECT_ID}.svc.id.goog</pre><pre>gcloud container clusters create staging-cluster --region=$REGION --scopes=cloud-platform --workload-pool=${PROJECT_ID}.svc.id.goog</pre><pre>gcloud container clusters create production-cluster --region=$REGION --scopes=cloud-platform --workload-pool=${PROJECT_ID}.svc.id.goog</pre><p><strong>Create a Google Cloud Artifact Registry</strong></p><pre>ARTIFACT_REPO_NAME=&lt;name of artifact repository&gt;</pre><pre>gcloud artifacts repositories create $ARTIFACT_REPO_NAME --repository-format=docker --location=$REGION</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tcVlsYX6ueg6d0ykj6rF4w.png" /></figure><p><strong>Create a Build trigger</strong></p><pre>gcloud beta builds triggers create cloud-source-repositories  --repo=$SOURCE_REPO_NAME --branch-pattern=”^master$” --build-config=cloudbuild.yaml</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R_RBN99CGKuAF_l07f-ncg.png" /></figure><p><strong>Grant Cloud Build service account permission to operate Cloud Deploy.</strong></p><ol><li><em>Open the IAM page:</em></li><li><em>Select your Cloud project.</em></li><li><em>In the permissions table, locate the row with the email address ending with </em><em>@cloudbuild.gserviceaccount.com. This is your Cloud Build service account.</em></li><li><em>Click on the pencil icon.</em></li><li><em>Select the role </em><strong><em>Cloud Deploy Operator</em></strong><em> and grant it to the Cloud Build service account.</em></li><li><em>Click </em><strong><em>Save</em></strong><em>.</em></li></ol><p><strong>Add the Google Kubernetes Engine Developer role to your account:</strong></p><ol><li><em>Open the Cloud Build Settings page, You’ll see the </em><strong><em>Service account permissions</em></strong><em> page</em></li><li><em>Set the status of the </em><strong><em>Kubernetes Engine Developer</em></strong><em> role to </em><strong><em>Enabled</em></strong><em>.</em></li></ol><p><strong>Create clouddeploy.yaml file at the root of the code base, as below:</strong></p><pre>apiVersion: deploy.cloud.google.com/v1<br>kind: DeliveryPipeline<br>metadata:<br> name: boutique<br>description: main application pipeline<br>serialPipeline:<br> stages:<br> - targetId: qa<br>   profiles: []<br> - targetId: staging<br>   profiles: []<br> - targetId: prod<br>   profiles: []<br>---</pre><pre>apiVersion: deploy.cloud.google.com/v1<br>kind: Target<br>metadata:<br> name: qa<br>description: development cluster<br>gke:<br> cluster: projects/<strong>&lt;project-id&gt;</strong>/locations/<strong>&lt;region&gt;</strong>/clusters/qa-cluster<br>---</pre><pre>apiVersion: deploy.cloud.google.com/v1<br>kind: Target<br>metadata:<br> name: staging<br>description: production cluster<br>gke:<br> cluster: projects/<strong>&lt;project-id&gt;</strong>/locations/<strong>&lt;region&gt;</strong>/clusters/staging-cluster</pre><pre>---</pre><pre>apiVersion: deploy.cloud.google.com/v1<br>kind: Target<br>metadata:<br> name: prod<br>description: production cluster<br>gke:<br> cluster: projects/<strong>&lt;project-id&gt;</strong>/locations/<strong>&lt;region&gt;</strong>/clusters/production-cluster</pre><p><strong>Change the Cloudbuild.yaml to include Artifact Registry and trigger Cloud Deploy, as below:</strong></p><pre>steps:<br> - id: &#39;prepare build and run skaffold&#39;<br>   name: &#39;gcr.io/k8s-skaffold/skaffold:v0.20.0&#39;<br>   entrypoint: &#39;bash&#39;<br>   args:<br>   - &#39;-c&#39;<br>   - &gt;<br>     gcloud auth configure-docker <strong>&lt;region&gt;</strong>-docker.pkg.dev;<br>     skaffold build -f=skaffold.yaml \<br>                    --build-concurrency=0 \<br>                    --default-repo=<strong>&lt;artifact registry endpoint&gt;</strong> \<br>                    --file-output /workspace/artifacts.json;<br> - id: &#39;Deploy to cluster&#39;<br>   name: &#39;google/cloud-sdk:latest&#39;<br>   entrypoint: &#39;bash&#39;<br>   args:<br>   - &#39;-c&#39;<br>   - &gt;<br>     gcloud deploy apply --file clouddeploy.yaml --region=<strong>&lt;region&gt;</strong> --project=<strong>&lt;project-id&gt;</strong>;<br>     gcloud deploy releases create boutique-$SHORT_SHA \<br>                         --delivery-pipeline boutique \<br>                         --description &quot;$(git log -1  --pretty=&#39;%s&#39;)&quot; \<br>                         --region=<strong>&lt;region&gt;</strong> \<br>                         --build-artifacts /workspace/artifacts.json</pre><pre># Add more power, and more time, for heavy Skaffold build<br> timeout: &#39;3600s&#39;<br> options:<br>   machineType: &#39;N1_HIGHCPU_8&#39;</pre><p><strong>Push the code to the repository using git commands.</strong></p><p><strong>You can trace the Cloud Deploy console and promote the deployment to next stage.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/0*2bQUa4eKfnm9lxZk" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/0*Kf1Ua4R_UUjSCP-Z" /></figure><p><strong>Now you can make any changes to the application and push the updated code to the repository, the Cloud Build will be triggered automatically and the Cloud Deploy pipeline will be executed.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0MC7Vg4xLwmC-pB6bwrAkg.png" /></figure><h3>Coming up…</h3><p>In this blog, we learned how to implement end to end CI/CD workflow on Google cloud for Samajik’s containerised workloads. In our next conversation we will understand how Logging and Monitoring operations are performed in Google Cloud. Stay tuned to Ram and Guhan’s conversation to know more about this.</p><p>Contributors: <a href="https://medium.com/u/c79cc28e2999">Pushkar Kothavade</a>, <a href="https://medium.com/u/41b475b881ff">Shijimol A K</a>, <a href="https://medium.com/u/71d9487165c6">Dhandus</a>, <a href="https://medium.com/u/ee905ea343d">Tushar Gupta</a></p><p>Update: You can read Part-5 <a href="https://medium.com/google-cloud/part-5-google-devops-observability-with-sre-principles-33446da05c16">here</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3feb1ea2227e" width="1" height="1" alt=""><hr><p><a href="https://medium.com/google-cloud/part-4-google-devops-continuous-development-workflow-3feb1ea2227e">Google Cloud DevOps Series: Continuous Integration / Continuous Deployment Workflow (CICD)</a> was originally published in <a href="https://medium.com/google-cloud">Google Cloud - Community</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>