{"id":639,"date":"2017-10-15T08:31:57","date_gmt":"2017-10-15T08:31:57","guid":{"rendered":"http:\/\/tuxlabs.com\/?p=639"},"modified":"2020-01-04T17:09:08","modified_gmt":"2020-01-04T17:09:08","slug":"setting-up-kubernetes-to-manage-containers-on-the-google-cloud-platform","status":"publish","type":"post","link":"https:\/\/tuxlabs.com\/?p=639","title":{"rendered":"Setting up Kubernetes to manage containers on the Google Cloud Platform"},"content":{"rendered":"<p><a href=\"http:\/\/tuxlabs.com\/wp-content\/uploads\/2017\/10\/GCPkubernetes.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-646\" src=\"http:\/\/tuxlabs.com\/wp-content\/uploads\/2017\/10\/GCPkubernetes.jpg\" alt=\"\" width=\"700\" height=\"280\"\/><\/a><\/p>\n<p>These days the pace of innovation in DevOps can leave you feeling like you&#8217;re jogging on a treadmill programmed to run faster than <a href=\"https:\/\/en.wikipedia.org\/wiki\/Usain_Bolt\">Usain Bolt<\/a>. Mastery requires hours of practice and the last decade in DevOps has not allowed for it. Before gaining 10 years of experience running virtual machines using VmWare in private data-centers, private cloud software like Openstack and Cloudstack came along, and just when you and your team painfully achieved a stable install you were told running virtual machines in public clouds like <a href=\"https:\/\/aws.amazon.com\">AWS<\/a>, <a href=\"https:\/\/cloud.google.com\">GCP<\/a>, and <a href=\"https:\/\/azure.microsoft.com\">Azure<\/a> is the way forward. By the time you got there it was time to switch to containers, and before you can fully appreciate those, server-less functions are on the horizon, but I digress. If you want to know more about server-less functions, see <a href=\"http:\/\/tuxlabs.com\/?p=626\">my previous article on AWS Lambda<\/a>. Instead, this article will focus on running <a href=\"https:\/\/en.wikipedia.org\/wiki\/Docker_(software)\">Docker containers<\/a> inside of a <a href=\"https:\/\/kubernetes.io\/\">Kubernetes<\/a> cluster on <a href=\"https:\/\/cloud.google.com\/\">Google&#8217;s Cloud Platform<\/a>.<\/p>\n<p>Linux <a href=\"https:\/\/www.docker.com\/what-container\">Containers<\/a>, which were recently popularized by <a href=\"https:\/\/www.docker.com\/company\">Docker<\/a> need something to help manage them and while there are many choices, <a href=\"https:\/\/kubernetes.io\/\">Kubernetes<\/a> the open-sourced container management system from Google is the undisputed king at this time. Given that Kubernetes was started by Google, it should be expected that the easiest way to install it is using Google&#8217;s Cloud Platform (GCP). However,&nbsp;<a href=\"https:\/\/www.openshift.com\/\">Openshift<\/a> from <a href=\"https:\/\/www.redhat.com\/en\">Redhat<\/a> also provides a nice batteries included abstraction if you need to get up and running quickly as well as <a href=\"https:\/\/github.com\/kubernetes\/kops\">kops<\/a>.<\/p>\n<h3>Pre-Requisites<\/h3>\n<p>The main pre-requisites you need for this article is a <a href=\"https:\/\/console.cloud.google.com\">Google Cloud Platform account<\/a>&nbsp;and installing the <a href=\"https:\/\/cloud.google.com\/sdk\/\">gcloud<\/a> utility via the <a href=\"https:\/\/cloud.google.com\/sdk\/\">SDK<\/a>.<\/p>\n<p>In addition, you need some form of a computer with Internet connectivity, some typing skills, a brain that can read, and a determination to finish&#8230;For now I will give you the benefit of the doubt and assume you have all of these. It is also nice to have your beverage of choice while you do this, a fine tea, ice cold beer, or glass of wine will work, but for Cancer&#8217;s sake please skip the sugar.<\/p>\n<blockquote><p>Here is where I would normally insert a link to facts on sugar and Cancer&#8217;s link, but I literally just learned I would be spreading&nbsp;<a href=\"http:\/\/scienceblog.cancerresearchuk.org\/2017\/05\/15\/sugar-and-cancer-what-you-need-to-know\/\">rumors<\/a>&#8230; Fine drink your Kool-Aid, but don&#8217;t blame me for your calories.<\/p><\/blockquote>\n<h3>The Build Out of our Self Healing IRC Server Hosting Containers<\/h3>\n<p>I lied dude, <a href=\"https:\/\/en.wikipedia.org\/wiki\/Internet_Relay_Chat\">IRC<\/a> is so 1995 and unfortunately, <a href=\"https:\/\/en.wikipedia.org\/wiki\/ICQ\">ICQ&#8217;s<\/a> been dead and <a href=\"https:\/\/slack.com\">Slack<\/a> won&#8217;t let me host their sexy chat application with game like spirit and better jokes than <a href=\"https:\/\/en.wikipedia.org\/wiki\/Kevin_Hart\">Kevin Heart<\/a>. So&#8230;sorry to excite you&#8230; but I guess I will fallback to the <a href=\"https:\/\/kubernetes.io\/docs\/tasks\/run-application\/run-stateless-application-deployment\/\">docs<\/a> here and install <a href=\"https:\/\/www.nginx.com\/\">Nginx<\/a> like us<a href=\"http:\/\/www.urbandictionary.com\/define.php?term=newb\"> newb&#8217;s<\/a> are supposed to.<\/p>\n<h3>Numero Uno (Step 1 dude)<\/h3>\n<p>As part of the <a href=\"https:\/\/cloud.google.com\/sdk\/\">installation of the gcloud \/ SDK<\/a> you should have ran gcloud init, which requires you to login with your Google account via a web browser.<\/p>\n<pre class=\"lang:default decode:true\">You must log in to continue. Would you like to log in (Y\/n)?  Y\n\nYour browser has been opened to visit:\n\n    https:\/\/accounts.google.com\/o\/oauth2\/auth?redirect_uri=http%3A%2F%2Flocalhost%3A8085%2F&prompt=select_account&response_type=code&client_id=32555940559.apps.googleusercontent.com&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcloud-platform+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fappengine.admin+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcompute+https%3A%2F%2Fwww.googleapis.com%2Fauth%2Faccounts.reauth&access_type=offline\n\n\nYou are logged in as: [tuxninja@tuxlabs.com].\n\nThis account has no projects.\n\nWould you like to create one? (Y\/n)?  Y\n<\/pre>\n<p>After clicking allow in your browser you will be logged in&#8230;and asked about creating an initial Project. Say yes (type Y and hit enter).<\/p>\n<pre class=\"lang:default decode:true \">Enter a Project ID. Note that a Project ID CANNOT be changed later.\nProject IDs must be 6-30 characters (lowercase ASCII, digits, or\nhyphens) in length and start with a lowercase letter. tuxlabsdemo\nYour current project has been set to: [tuxlabsdemo].\n\nNot setting default zone\/region (this feature makes it easier to use\n[gcloud compute] by setting an appropriate default value for the\n--zone and --region flag).\nSee https:\/\/cloud.google.com\/compute\/docs\/gcloud-compute section on how to set\ndefault compute region and zone manually. If you would like [gcloud init] to be\nable to do this for you the next time you run it, make sure the\nCompute Engine API is enabled for your project on the\nhttps:\/\/console.developers.google.com\/apis page.\n\nYour Google Cloud SDK is configured and ready to use!\n<\/pre>\n<p>Sweet your Project is now created. In order to use the Google Cloud API&#8217;s you must first enable access by visiting&nbsp;<a href=\"https:\/\/console.developers.google.com\/apis\/api\/replicapool.googleapis.com\/overview\">https:\/\/console.developers.google.com\/apis\/api\/replicapool.googleapis.com\/overview<\/a>&nbsp;and clicking enable.<\/p>\n<p><a href=\"http:\/\/tuxlabs.com\/wp-content\/uploads\/2017\/10\/enableapi.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-658\" src=\"http:\/\/tuxlabs.com\/wp-content\/uploads\/2017\/10\/enableapi.jpg\" alt=\"\" width=\"400\" height=\"180\"\/><\/a><\/p>\n<p>That will take a minute. Once completed you will be able to run gcloud commands against your Project. We can set the default region for our project like so:<\/p>\n<pre class=\"lang:default decode:true\">tuxninja@tldev1:~\/google-cloud-sdk$ gcloud compute project-info add-metadata --metadata google-compute-default-region=us-west1\nUpdated [https:\/\/www.googleapis.com\/compute\/v1\/projects\/tuxlabsdemo].\ntuxninja@tldev1:~\/google-cloud-sdk$ \n<\/pre>\n<p>If you get an error here, stop being cheap and link your project to your billing account in the console.<\/p>\n<p>Additionally, we want to set the default region\/zone for gcloud commands like so:<\/p>\n<pre class=\"lang:default decode:true\">tuxninja@tldev1:~$ gcloud config set compute\/region us-west1\nUpdated property [compute\/region].\ntuxninja@tldev1:~$ gcloud config set compute\/zone us-west1-a\nUpdated property [compute\/zone].\ntuxninja@tldev1:~$ \n<\/pre>\n<h3>Numero&nbsp;<a href=\"http:\/\/s2.quickmeme.com\/img\/d4\/d44cf2aaf3ea5e48368dc394a9167a32adfccc8ae56b70de0f4bd48e2a739b12.jpg\">Dos Equis<\/a><\/h3>\n<p>We need to install kubectl so we can interact with Kubernetes.<\/p>\n<pre class=\"lang:default decode:true \">tuxninja@tldev1:~$ gcloud components install kubectl\n\n\nYour current Cloud SDK version is: 175.0.0\nInstalling components from version: 175.0.0\n\n\u250c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2510\n\u2502               These components will be installed.                \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u252c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502         Name        \u2502       Version       \u2502         Size         \u2502\n\u251c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2524\n\u2502 kubectl             \u2502               1.7.6 \u2502             16.0 MiB \u2502\n\u2502 kubectl             \u2502                     \u2502                      \u2502\n\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2534\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518\n\nFor the latest full release notes, please visit:\n  https:\/\/cloud.google.com\/sdk\/release_notes\n\nDo you want to continue (Y\/n)?  Y\n\n\u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n\u2560\u2550 Creating update staging area                             \u2550\u2563\n\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n\u2560\u2550 Installing: kubectl                                      \u2550\u2563\n\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n\u2560\u2550 Installing: kubectl                                      \u2550\u2563\n\u2560\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2563\n\u2560\u2550 Creating backup and activating new installation          \u2550\u2563\n\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d\n\nPerforming post processing steps...done.                                                                                                                      \n\nUpdate done!\n\ntuxninja@tldev1:~$ \n<\/pre>\n<p>Once that is done, quickly realize someone spent an obscene amount of time making that install as pretty as it was without using <a href=\"https:\/\/en.wikipedia.org\/wiki\/Ncurses\">ncurses<\/a>. Shout out to that geek.<\/p>\n<h3>Numero&nbsp;<a href=\"https:\/\/www.youtube.com\/watch?v=w3qqN1BMnhk\">Tres&nbsp;Deliquentes<\/a><\/h3>\n<p>Time to create our Kubernetes cluster. Run this command and &#8220;it&#8217;s going to be <strong>LEGEND<\/strong>&#8230;.<strong>Wait for it<\/strong>&#8230;.<\/p>\n<pre class=\"lang:default decode:true\">tuxninja@tldev1:~$ gcloud container clusters create tuxlabs-kubernetes                           \nCreating cluster tuxlabs-kubernetes...done.                                                   \nCreated [https:\/\/container.googleapis.com\/v1\/projects\/tuxlabsdemo\/zones\/us-west1-a\/clusters\/tuxlabs-kubernetes].\nkubeconfig entry generated for tuxlabs-kubernetes.\nNAME                ZONE        MASTER_VERSION  MASTER_IP       MACHINE_TYPE   NODE_VERSION  NUM_NODES  STATUS\ntuxlabs-kubernetes  us-west1-a  1.7.6-gke.1     35.197.120.249  n1-standard-1  1.7.6         3          RUNNING\ntuxninja@tldev1:~$<\/pre>\n<p>And I hope you&#8217;re not lactose intolerant cause the second half of that word is <strong><a href=\"https:\/\/www.youtube.com\/watch?v=C19US6rqqAo\">DAIRY<\/a><\/strong>.&#8221; &#8211; NPH<\/p>\n<h3>Numero <a href=\"https:\/\/en.wikipedia.org\/wiki\/Audi_Quattro\">(Audi) Quattro<\/a><\/h3>\n<p>Now you should be able to <strong>see all running Kubernetes services<\/strong> in your cluster like so:<\/p>\n<pre class=\"lang:default decode:true \">tuxninja@tldev1:~$ kubectl get --all-namespaces services\nNAMESPACE     NAME                   TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)         AGE\ndefault       kubernetes             ClusterIP   10.19.240.1     &lt;none&gt;        443\/TCP         15m\nkube-system   default-http-backend   NodePort    10.19.254.83    &lt;none&gt;        80:31154\/TCP    14m\nkube-system   heapster               ClusterIP   10.19.247.182   &lt;none&gt;        80\/TCP          14m\nkube-system   kube-dns               ClusterIP   10.19.240.10    &lt;none&gt;        53\/UDP,53\/TCP   14m\nkube-system   kubernetes-dashboard   ClusterIP   10.19.249.188   &lt;none&gt;        80\/TCP          14m\ntuxninja@tldev1:~$<\/pre>\n<p>And we can <strong>see the pods like so:<\/strong><\/p>\n<pre class=\"lang:default decode:true \">tuxninja@tldev1:~$ kubectl get --all-namespaces pods\nNAMESPACE     NAME                                                           READY     STATUS    RESTARTS   AGE\nkube-system   event-exporter-1421584133-zlvnd                                2\/2       Running   0          16m\nkube-system   fluentd-gcp-v2.0-1nb9x                                         2\/2       Running   0          16m\nkube-system   fluentd-gcp-v2.0-bpqtv                                         2\/2       Running   0          16m\nkube-system   fluentd-gcp-v2.0-mntjl                                         2\/2       Running   0          16m\nkube-system   heapster-v1.4.2-339128277-gxh5g                                3\/3       Running   0          15m\nkube-system   kube-dns-3468831164-5nn05                                      3\/3       Running   0          15m\nkube-system   kube-dns-3468831164-wcwtg                                      3\/3       Running   0          16m\nkube-system   kube-dns-autoscaler-244676396-fnq9g                            1\/1       Running   0          16m\nkube-system   kube-proxy-gke-tuxlabs-kubernetes-default-pool-6ede7d6a-nvfg   1\/1       Running   0          16m\nkube-system   kube-proxy-gke-tuxlabs-kubernetes-default-pool-6ede7d6a-pr82   1\/1       Running   0          16m\nkube-system   kube-proxy-gke-tuxlabs-kubernetes-default-pool-6ede7d6a-w6p8   1\/1       Running   0          16m\nkube-system   kubernetes-dashboard-1265873680-gftnz                          1\/1       Running   0          16m\nkube-system   l7-default-backend-3623108927-57292                            1\/1       Running   0          16m\ntuxninja@tldev1:~$ \n<\/pre>\n<h3>Numero <a href=\"https:\/\/en.wikipedia.org\/wiki\/Cinco_de_Mayo\">Cinco (de Mayo)<\/a><\/h3>\n<p>You now have an active Kubernetes cluster. That is pretty sweet huh? Make sure you take the time to check out what&#8217;s running under the hood in the Google Compute Engine as well.<\/p>\n<pre class=\"lang:default decode:true \">tuxninja@tldev1:~$ gcloud compute instances list\nNAME                                               ZONE        MACHINE_TYPE   PREEMPTIBLE  INTERNAL_IP  EXTERNAL_IP     STATUS\ngke-tuxlabs-kubernetes-default-pool-6ede7d6a-nvfg  us-west1-a  n1-standard-1               10.138.0.2   35.197.94.114   RUNNING\ngke-tuxlabs-kubernetes-default-pool-6ede7d6a-pr82  us-west1-a  n1-standard-1               10.138.0.3   35.197.2.247    RUNNING\ngke-tuxlabs-kubernetes-default-pool-6ede7d6a-w6p8  us-west1-a  n1-standard-1               10.138.0.4   35.197.117.173  RUNNING\ntuxninja@tldev1:~$ \n<\/pre>\n<p>Ok, for our final act, I promised <a href=\"https:\/\/www.nginx.com\/\"><strong>Nginx<\/strong><\/a>&#8230;sigh&#8230;Let&#8217;s get this over with!<\/p>\n<p><strong>Step 1, create this nifty YAML file:<\/strong><\/p>\n<pre class=\"lang:default decode:true \">apiVersion: apps\/v1beta1\nkind: Deployment\nmetadata:\n  name: nginx-deployment\nspec:\n  selector:\n    matchLabels:\n      app: nginx\n  replicas: 2 # tells deployment to run 2 pods matching the template\n  template: # create pods using pod definition in this template\n    metadata:\n      # unlike pod-nginx.yaml, the name is not included in the meta data as a unique name is\n      # generated from the deployment name\n      labels:\n        app: nginx\n    spec:\n      containers:\n      - name: nginx\n        image: nginx:1.7.9\n        ports:\n        - containerPort: 80\n<\/pre>\n<p><strong>Save it as deployment.yaml, then apply it!<\/strong><\/p>\n<pre class=\"lang:default decode:true \">tuxninja@tldev1:~$ kubectl apply -f deployment.yaml \ndeployment \"nginx-deployment\" created\ntuxninja@tldev1:~$<\/pre>\n<p><strong>We can describe our deployment like this:<\/strong><\/p>\n<pre class=\"lang:default decode:true \">tuxninja@tldev1:~$ kubectl describe deployment nginx-deployment\nName:                   nginx-deployment\nNamespace:              default\nCreationTimestamp:      Sun, 15 Oct 2017 07:10:52 +0000\nLabels:                 app=nginx\nAnnotations:            deployment.kubernetes.io\/revision=1\n                        kubectl.kubernetes.io\/last-applied-configuration={\"apiVersion\":\"apps\/v1beta1\",\"kind\":\"Deployment\",\"metadata\":{\"annotations\":{},\"name\":\"nginx-deployment\",\"namespace\":\"default\"},\"spec\":{\"replicas\":2,\"se...\nSelector:               app=nginx\nReplicas:               2 desired | 2 updated | 2 total | 2 available | 0 unavailable\nStrategyType:           RollingUpdate\nMinReadySeconds:        0\nRollingUpdateStrategy:  25% max unavailable, 25% max surge\nPod Template:\n  Labels:  app=nginx\n  Containers:\n   nginx:\n    Image:        nginx:1.7.9\n    Port:         80\/TCP\n    Environment:  &lt;none&gt;\n    Mounts:       &lt;none&gt;\n  Volumes:        &lt;none&gt;\nConditions:\n  Type           Status  Reason\n  ----           ------  ------\n  Available      True    MinimumReplicasAvailable\n  Progressing    True    NewReplicaSetAvailable\nOldReplicaSets:  &lt;none&gt;\nNewReplicaSet:   nginx-deployment-431080787 (2\/2 replicas created)\nEvents:\n  Type    Reason             Age   From                   Message\n  ----    ------             ----  ----                   -------\n  Normal  ScalingReplicaSet  3m    deployment-controller  Scaled up replica set nginx-deployment-431080787 to 2\ntuxninja@tldev1:~$<\/pre>\n<p><strong>And we can take a gander at the pods created for this deployment<\/strong><\/p>\n<pre class=\"lang:default decode:true \">tuxninja@tldev1:~$ kubectl get pods -l app=nginx\nNAME                               READY     STATUS    RESTARTS   AGE\nnginx-deployment-431080787-7131f   1\/1       Running   0          4m\nnginx-deployment-431080787-cgwn8   1\/1       Running   0          4m\ntuxninja@tldev1:~$<\/pre>\n<p><strong>To see info about a specific pod run:&nbsp;<\/strong><\/p>\n<pre class=\"lang:default decode:true \">tuxninja@tldev1:~$ kubectl describe pod nginx-deployment-431080787-7131f\nName:           nginx-deployment-431080787-7131f\nNamespace:      default\nNode:           gke-tuxlabs-kubernetes-default-pool-6ede7d6a-nvfg\/10.138.0.2\nStart Time:     Sun, 15 Oct 2017 07:10:52 +0000\nLabels:         app=nginx\n                pod-template-hash=431080787\nAnnotations:    kubernetes.io\/created-by={\"kind\":\"SerializedReference\",\"apiVersion\":\"v1\",\"reference\":{\"kind\":\"ReplicaSet\",\"namespace\":\"default\",\"name\":\"nginx-deployment-431080787\",\"uid\":\"faa4d17b-b177-11e7-b439-42010...\n                kubernetes.io\/limit-ranger=LimitRanger plugin set: cpu request for container nginx\nStatus:         Running\nIP:             10.16.1.4\nCreated By:     ReplicaSet\/nginx-deployment-431080787\nControlled By:  ReplicaSet\/nginx-deployment-431080787\nContainers:\n  nginx:\n    Container ID:   docker:\/\/ce850ea012243e6d31e5eabfcc07aa71c33b3c1935e1ff1670282f22ac1d0907\n    Image:          nginx:1.7.9\n    Image ID:       docker-pullable:\/\/nginx@sha256:e3456c851a152494c3e4ff5fcc26f240206abac0c9d794affb40e0714846c451\n    Port:           80\/TCP\n    State:          Running\n      Started:      Sun, 15 Oct 2017 07:11:01 +0000\n    Ready:          True\n    Restart Count:  0\n    Requests:\n      cpu:        100m\n    Environment:  &lt;none&gt;\n    Mounts:\n      \/var\/run\/secrets\/kubernetes.io\/serviceaccount from default-token-gw047 (ro)\nConditions:\n  Type           Status\n  Initialized    True \n  Ready          True \n  PodScheduled   True \nVolumes:\n  default-token-gw047:\n    Type:        Secret (a volume populated by a Secret)\n    SecretName:  default-token-gw047\n    Optional:    false\nQoS Class:       Burstable\nNode-Selectors:  &lt;none&gt;\nTolerations:     node.alpha.kubernetes.io\/notReady:NoExecute for 300s\n                 node.alpha.kubernetes.io\/unreachable:NoExecute for 300s\nEvents:\n  Type    Reason                 Age   From                                                        Message\n  ----    ------                 ----  ----                                                        -------\n  Normal  Scheduled              5m    default-scheduler                                           Successfully assigned nginx-deployment-431080787-7131f to gke-tuxlabs-kubernetes-default-pool-6ede7d6a-nvfg\n  Normal  SuccessfulMountVolume  5m    kubelet, gke-tuxlabs-kubernetes-default-pool-6ede7d6a-nvfg  MountVolume.SetUp succeeded for volume \"default-token-gw047\"\n  Normal  Pulling                5m    kubelet, gke-tuxlabs-kubernetes-default-pool-6ede7d6a-nvfg  pulling image \"nginx:1.7.9\"\n  Normal  Pulled                 5m    kubelet, gke-tuxlabs-kubernetes-default-pool-6ede7d6a-nvfg  Successfully pulled image \"nginx:1.7.9\"\n  Normal  Created                5m    kubelet, gke-tuxlabs-kubernetes-default-pool-6ede7d6a-nvfg  Created container\n  Normal  Started                5m    kubelet, gke-tuxlabs-kubernetes-default-pool-6ede7d6a-nvfg  Started container\ntuxninja@tldev1:~$ \n<\/pre>\n<p><strong>Finally it&#8217;s time to expose Nginx to the Internet<\/strong><\/p>\n<pre class=\"lang:default decode:true\">tuxninja@tldev1:~$ kubectl expose deployment\/nginx-deployment --port=80 --target-port=80 --name=nginx-deployment --type=LoadBalancer\nservice \"nginx-deployment\" exposed\ntuxninja@tldev1:~<\/pre>\n<p><strong>Check the status of our service<\/strong><\/p>\n<pre class=\"lang:default decode:true \">tuxninja@tldev1:~$ kubectl get svc nginx-deploymentNAME               TYPE           CLUSTER-IP     EXTERNAL-IP   PORT(S)        AGE\nnginx-deployment   LoadBalancer   10.19.244.29   &lt;pending&gt;     80:31867\/TCP   20s\ntuxninja@tldev1:~$<\/pre>\n<p><strong>Note the EXTERNAL-IP is in a pending state, once the LoadBalancer is created, this will have an IP address.<\/strong><\/p>\n<pre class=\"lang:default decode:true \">tuxninja@tldev1:~$ kubectl get svc nginx-deployment\nNAME               TYPE           CLUSTER-IP     EXTERNAL-IP      PORT(S)        AGE\nnginx-deployment   LoadBalancer   10.19.244.29   35.203.155.123   80:31867\/TCP   1m\ntuxninja@tldev1:~$ curl http:\/\/35.203.155.123\n&lt;!DOCTYPE html&gt;\n&lt;html&gt;\n&lt;head&gt;\n&lt;title&gt;Welcome to nginx!&lt;\/title&gt;\n<\/pre>\n<p><strong>And were all done, congratulations! \ud83d\ude42<\/strong><\/p>\n<h3>In Closing&#8230;<\/h3>\n<p>Kubernetes is <strong>cool as a fan<\/strong>, and setting it up on GCP is almost as easy as pressing the<strong>&nbsp;<a href=\"https:\/\/www.staples.com\/Staples-Easy-Button\/product_606396\">big EASY button<\/a>.<\/strong> We have barely scraped the surface here so for continued learning I recommend buying <a href=\"http:\/\/Kubernetes Up &amp; Running\">Kubernetes Up &amp; Running<\/a> by <strong><a href=\"https:\/\/twitter.com\/kelseyhightower\">Kelsey Hightower<\/a>, <a href=\"https:\/\/twitter.com\/brendandburns\">Brendan Burns<\/a><\/strong> and <strong><a href=\"https:\/\/twitter.com\/jbeda\">Joe Beda<\/a><\/strong>. I would<strong> follow these folks on twitter<\/strong>, and in addition follow Kubernetes Co-Founder <strong><a href=\"https:\/\/twitter.com\/thockin\">Tim Hockin<\/a><\/strong>&nbsp;as well as former Docker, Google, and now Microsoft employee\/guru of all things containers<strong>&nbsp;<a href=\"https:\/\/twitter.com\/jessfraz\">Jessie Frazelle.<\/a><\/strong><\/p>\n<p>After you are done following these inspirational leaders in the community go to youtube and <strong>watch every Kelsey Hightower video you can find<\/strong>. Kelsey Hightower is perhaps the tech communities best presenter and no one has done more to educate and bring Kubernetes to the mainstream than Kelsey. So a quick shout out and<strong> thank you to Kelsey for his contributions to the community<\/strong>. In his honor here are two of my favorite videos from Kelsey. [ <a href=\"https:\/\/www.youtube.com\/watch?v=HlAXp0-M6SY\">one<\/a> ] [ <a href=\"https:\/\/www.youtube.com\/watch?v=36S7N7OZSTI&amp;feature=youtu.be&amp;t=45m5s\">two<\/a> ].<\/p>\n","protected":false},"excerpt":{"rendered":"<a href=\"https:\/\/tuxlabs.com\/?p=639\" rel=\"bookmark\" title=\"Permalink to Setting up Kubernetes to manage containers on the Google Cloud Platform\"><p>These days the pace of innovation in DevOps can leave you feeling like you&#8217;re jogging on a treadmill programmed to run faster than Usain Bolt. Mastery requires hours of practice and the last decade in DevOps has not allowed for it. Before gaining 10 years of experience running virtual machines using VmWare in private data-centers, [&hellip;]<\/p>\n<\/a>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[130,184,183,1,185],"tags":[132,188,158,186,149,187,189],"class_list":{"0":"post-639","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-cloud","7":"category-containers","8":"category-gcp","9":"category-howtos","10":"category-kubernetes","11":"tag-cloud","12":"tag-containers","13":"tag-docker","14":"tag-gcp","15":"tag-google-cloud-platform","16":"tag-kubernetes","17":"tag-nginx","18":"h-entry","19":"hentry"},"_links":{"self":[{"href":"https:\/\/tuxlabs.com\/index.php?rest_route=\/wp\/v2\/posts\/639","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tuxlabs.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tuxlabs.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tuxlabs.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tuxlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=639"}],"version-history":[{"count":32,"href":"https:\/\/tuxlabs.com\/index.php?rest_route=\/wp\/v2\/posts\/639\/revisions"}],"predecessor-version":[{"id":710,"href":"https:\/\/tuxlabs.com\/index.php?rest_route=\/wp\/v2\/posts\/639\/revisions\/710"}],"wp:attachment":[{"href":"https:\/\/tuxlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=639"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tuxlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=639"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tuxlabs.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=639"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}