No time to explain! or how to make terraform with minikube and kubernetes


How to start using terraform by expanding locally the application on top of minikube and then start it over kubernetes cloud.google.com


Minikube


first set up minikube and with terraform will deploy our application, this has prepared project. Remains only:


    the
  1. Install VirtualBox
  2. the
  3. Install Vagrant
  4. the
  5. to Make the repository copy ultral/terraform-example
  6. the
  7. to Make
    the
    vagrant up

On output, we have a virtual machine at 192.168.56.123 c login/password vagrant/vagrant and/or your public key for the users root and vagrant.


Google cloud


this is where things get interesting, we will connect to cloud.google.com there and launch our app.


    the
  1. Register https://cloud.google.com to get $ 300
  2. the
  3. On the deployed VM do gcloud init and follow instructions
    the
    gcloud init
  4. the
  5. the instructions get the key in developer console and put in /root/.gcloud/terraform.json virtual machine
  6. the
  7. Creates a cluster cloud.google.com
    the
    gcloud container clusters create gke-cluster
    gcloud container clusters list
  8. the
  9. Get turnout/passwords to connect to kubectl cloud.google.com
    the
    [root@terraform-terraform adm]# gcloud container clusters get-credentials gke-cluster
    Fetching cluster endpoint and auth data.
    kubeconfig entry generated for gke-cluster.
  10. the
  11. Toggle context kubectl
    the
    [root@terraform-terraform adm]# kubectl config use-context gke_tutorial-project-183818_europe-west1-d_gke-cluster
    Switched to context "gke_tutorial-project-183818_europe-west1-d_gke-cluster".
  12. the
  13. Rename the context kubectl (he's listed in terraform)
    the
    [root@terraform-terraform adm]# kubectl config rename-context gke_tutorial-project-183818_europe-west1-d_gke-cluster gke_tutorial
    Context "gke_tutorial-project-183818_europe-west1-d_gke-cluster" was renamed to "gke_tutorial".
  14. the
  15. Prepare variables for image and likeness to terraform
    the
    cp /vagrant/terraform/terraform.tfvars.example /vagrant/terraform/terraform.tfvars
    vi /vagrant/terraform/terraform.tfvars
  16. the
  17. Prepare and apply terraform
    the
    workspace terraform new prod
    terraform init
    terraform plan
    terraform apply
  18. the
  19. Now you can get the address of our application log through the browser. We're good.
    the
    terraform output lb_ingress
  20. the
  21. dotting a few I's a
    the
    terraform destroy
    gcloud container clusters delete gke-cluster

Conclusion


Terraform was not so terrible. Terraform open space to structure and sustain environments in identical condition.

Article based on information from habrahabr.ru

Комментарии

Популярные сообщения из этого блога

Looking for books as you want

Automatically create Liquibase migrations for PostgreSQL

Vkontakte sync with address book for iPhone. How it was done