首页 > 其他 > 详细

terraform 使用

时间:2019-04-25 13:36:20      阅读:228      评论:0      收藏:0      [点我收藏+]

 1. 下载

  wget https://releases.hashicorp.com/terraform/0.11.13/terraform_0.11.13_linux_amd64.zip

 

2. 创建个测试的tf

  

provider "kubernetes" {}

resource "kubernetes_pod" nginx {
	metadata {
		name = "nginx-example-3"
		labels = {
			App = "nginx"
		}
	}

	spec {
		container {
			image = "nginx:1.7.8"
			name = "nginx-example-2"

			port {
				container_port = 80
			}
		}
	}
}

  

 

3.  运行

  

1. terraform init  #初始化,下载k8s的包

2. terraform plan #检查配置文件语法

3. terraform apply -auto-approve # 执行

执行完之后,查看

kubectl get pods  | grep nginx-example-3

nginx-example-3          1/1       Running   0          8m 

  

 

terraform 使用

原文:https://www.cnblogs.com/nika86/p/10767759.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!