-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit f76725d
Showing
121 changed files
with
38,398 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
|
||
# Local .terraform directories | ||
**/.terraform/* | ||
|
||
# .tfstate files | ||
*.tfstate | ||
*.tfstate.* | ||
|
||
# Crash log files | ||
crash.log | ||
|
||
# Exclude all .tfvars files, which are likely to contain sentitive data, such as | ||
# password, private keys, and other secrets. These should not be part of version | ||
# control as they are data points which are potentially sensitive and subject | ||
# to change depending on the environment. | ||
# | ||
*.tfvars | ||
.terraform.lock.hcl | ||
.DS_Store | ||
.gitattributes | ||
# Ignore override files as they are usually used to override resources locally and so | ||
# are not checked in | ||
override.tf | ||
override.tf.json | ||
*_override.tf | ||
*_override.tf.json | ||
|
||
# Include override files you do wish to add to version control using negated pattern | ||
# | ||
# !example_override.tf | ||
|
||
# Include tfplan files to ignore the plan output of command: terraform plan -out=tfplan | ||
# example: *tfplan* | ||
|
||
# Ignore CLI configuration files | ||
.terraformrc | ||
terraform.rc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
Terraform kubernetes provider with minikube | ||
|
||
# Prerequisites | ||
|
||
- terraform | ||
- minikube | ||
- kubectl | ||
|
||
# Example 1 : Creating namespaces on local minikube cluster via terraform | ||
|
||
cd namespaces | ||
|
||
minikube start | ||
terraform init | ||
terraform apply | ||
|
||
|
||
# Example 2 : Deploying sample hello world app on local minikube cluster via terraform | ||
|
||
minikube start | ||
|
||
terraform apply |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
# Configuring terraform kubernetes provider with minikube context and pointing to local kube config | ||
|
||
provider "kubernetes" { | ||
config_context_cluster = "minikube" | ||
config_path = "~/.kube/config" | ||
} | ||
|
||
# Creating namespaces | ||
|
||
resource "kubernetes_namespace" "applications-namespace" { | ||
metadata { | ||
name = "applications" | ||
} | ||
} | ||
|
||
resource "kubernetes_namespace" "monitoring-namespace" { | ||
metadata { | ||
name = "monitoring" | ||
} | ||
} | ||
|
||
|
||
|
||
# Deploying apps | ||
# https://registry.terraform.io/providers/hashicorp/kubernetes/latest/docs/resources/deployment | ||
|
||
# Deployment | ||
|
||
resource "kubernetes_deployment" "nginx" { | ||
metadata { | ||
name = "scalable-nginx-example" | ||
namespace = kubernetes_namespace.applications-namespace.id | ||
labels = { | ||
App = "ScalableNginxExample" | ||
} | ||
} | ||
|
||
spec { | ||
replicas = 2 | ||
selector { | ||
match_labels = { | ||
App = "ScalableNginxExample" | ||
} | ||
} | ||
template { | ||
metadata { | ||
labels = { | ||
App = "ScalableNginxExample" | ||
} | ||
} | ||
spec { | ||
container { | ||
image = "nginx:1.7.8" | ||
name = "example" | ||
|
||
port { | ||
container_port = 80 | ||
} | ||
|
||
resources { | ||
limits = { | ||
cpu = "0.5" | ||
memory = "512Mi" | ||
} | ||
requests = { | ||
cpu = "250m" | ||
memory = "50Mi" | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
||
# Service | ||
|
||
|
||
|
||
|
||
|
||
resource "kubernetes_service" "nginx-svc" { | ||
metadata { | ||
name = "nginx-example" | ||
namespace = kubernetes_namespace.applications-namespace.id | ||
} | ||
spec { | ||
selector = { | ||
App = kubernetes_deployment.nginx.spec.0.template.0.metadata[0].labels.App | ||
} | ||
port { | ||
node_port = 30201 | ||
port = 80 | ||
target_port = 80 | ||
} | ||
|
||
type = "NodePort" | ||
} | ||
} | ||
|
||
# minikube ip | ||
# Visit : <minikube ip>:30201 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
apiVersion: install.istio.io/v1alpha2 | ||
kind: IstioControlPlane | ||
spec: | ||
# Use the default profile as the base | ||
# More details at: https://istio.io/docs/setup/additional-setup/config-profiles/ | ||
profile: default | ||
values: | ||
global: | ||
# Ensure that the Istio pods are only scheduled to run on Linux nodes | ||
defaultNodeSelector: | ||
beta.kubernetes.io/os: linux |
Oops, something went wrong.