Removed Log Analytics resources from sample as not used in article
This commit is contained in:
parent
d0a579d375
commit
fe231e8d91
85
quickstart/201-k8s-cluster-with-tf-and-aks/azure-vote.yaml
Normal file
85
quickstart/201-k8s-cluster-with-tf-and-aks/azure-vote.yaml
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: azure-vote-back
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: azure-vote-back
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: azure-vote-back
|
||||||
|
spec:
|
||||||
|
nodeSelector:
|
||||||
|
"kubernetes.io/os": linux
|
||||||
|
containers:
|
||||||
|
- name: azure-vote-back
|
||||||
|
image: mcr.microsoft.com/oss/bitnami/redis:6.0.8
|
||||||
|
env:
|
||||||
|
- name: ALLOW_EMPTY_PASSWORD
|
||||||
|
value: "yes"
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
limits:
|
||||||
|
cpu: 250m
|
||||||
|
memory: 256Mi
|
||||||
|
ports:
|
||||||
|
- containerPort: 6379
|
||||||
|
name: redis
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: azure-vote-back
|
||||||
|
spec:
|
||||||
|
ports:
|
||||||
|
- port: 6379
|
||||||
|
selector:
|
||||||
|
app: azure-vote-back
|
||||||
|
---
|
||||||
|
apiVersion: apps/v1
|
||||||
|
kind: Deployment
|
||||||
|
metadata:
|
||||||
|
name: azure-vote-front
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app: azure-vote-front
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app: azure-vote-front
|
||||||
|
spec:
|
||||||
|
nodeSelector:
|
||||||
|
"kubernetes.io/os": linux
|
||||||
|
containers:
|
||||||
|
- name: azure-vote-front
|
||||||
|
image: mcr.microsoft.com/azuredocs/azure-vote-front:v1
|
||||||
|
resources:
|
||||||
|
requests:
|
||||||
|
cpu: 100m
|
||||||
|
memory: 128Mi
|
||||||
|
limits:
|
||||||
|
cpu: 250m
|
||||||
|
memory: 256Mi
|
||||||
|
ports:
|
||||||
|
- containerPort: 80
|
||||||
|
env:
|
||||||
|
- name: REDIS
|
||||||
|
value: "azure-vote-back"
|
||||||
|
---
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Service
|
||||||
|
metadata:
|
||||||
|
name: azure-vote-front
|
||||||
|
spec:
|
||||||
|
type: LoadBalancer
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
selector:
|
||||||
|
app: azure-vote-front
|
@ -14,30 +14,6 @@ locals {
|
|||||||
current_user_id = coalesce(var.msi_id, data.azurerm_client_config.current.object_id)
|
current_user_id = coalesce(var.msi_id, data.azurerm_client_config.current.object_id)
|
||||||
}
|
}
|
||||||
|
|
||||||
resource "random_pet" "azurerm_log_analytics_workspace_name" {
|
|
||||||
prefix = "ws"
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "azurerm_log_analytics_workspace" "test" {
|
|
||||||
location = var.log_analytics_workspace_location
|
|
||||||
name = random_pet.azurerm_log_analytics_workspace_name.id
|
|
||||||
resource_group_name = azurerm_resource_group.rg.name
|
|
||||||
sku = var.log_analytics_workspace_sku
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "azurerm_log_analytics_solution" "test" {
|
|
||||||
location = azurerm_log_analytics_workspace.test.location
|
|
||||||
resource_group_name = azurerm_resource_group.rg.name
|
|
||||||
solution_name = "ContainerInsights"
|
|
||||||
workspace_name = azurerm_log_analytics_workspace.test.name
|
|
||||||
workspace_resource_id = azurerm_log_analytics_workspace.test.id
|
|
||||||
|
|
||||||
plan {
|
|
||||||
product = "OMSGallery/ContainerInsights"
|
|
||||||
publisher = "Microsoft"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
resource "random_pet" "azurerm_kubernetes_cluster_name" {
|
resource "random_pet" "azurerm_kubernetes_cluster_name" {
|
||||||
prefix = "cluster"
|
prefix = "cluster"
|
||||||
}
|
}
|
||||||
|
@ -6,10 +6,6 @@ output "kubernetes_cluster_name" {
|
|||||||
value = azurerm_kubernetes_cluster.k8s.name
|
value = azurerm_kubernetes_cluster.k8s.name
|
||||||
}
|
}
|
||||||
|
|
||||||
output "log_analytics_workspace_name" {
|
|
||||||
value = azurerm_log_analytics_workspace.test.name
|
|
||||||
}
|
|
||||||
|
|
||||||
output "client_certificate" {
|
output "client_certificate" {
|
||||||
value = azurerm_kubernetes_cluster.k8s.kube_config[0].client_certificate
|
value = azurerm_kubernetes_cluster.k8s.kube_config[0].client_certificate
|
||||||
sensitive = true
|
sensitive = true
|
||||||
|
@ -16,27 +16,6 @@ variable "node_count" {
|
|||||||
default = 3
|
default = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
# For available Log Analytics regions, refer to:
|
|
||||||
# https://azure.microsoft.com/global-infrastructure/services/?products=monitor
|
|
||||||
variable "log_analytics_workspace_location" {
|
|
||||||
type = string
|
|
||||||
default = "eastus"
|
|
||||||
description = "Location of the Log Analytics workspace."
|
|
||||||
}
|
|
||||||
|
|
||||||
# For Log Analytics pricing, refer to:
|
|
||||||
# https://azure.microsoft.com/pricing/details/monitor
|
|
||||||
variable "log_analytics_workspace_sku" {
|
|
||||||
type = string
|
|
||||||
description = "The SKU of the Log Analytics workspace. Choose from: Free, PerNode, Premium, Standard, Standalone, Unlimited, CapacityReservation, PerGB2018"
|
|
||||||
default = "PerGB2018"
|
|
||||||
|
|
||||||
validation {
|
|
||||||
condition = contains(["Free", "PerNode", "Premium", "Standard", "Standalone", "Unlimited", "CapacityReservation", "PerGB2018"], var.log_analytics_workspace_sku)
|
|
||||||
error_message = "The Log Analytics workspace SKU must be one of the following: Free, PerNode, Premium, Standard, Standalone, Unlimited, CapacityReservation, PerGB2018"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
variable "msi_id" {
|
variable "msi_id" {
|
||||||
type = string
|
type = string
|
||||||
description = "The Managed Service Identity ID used to create the service principal. If this value is null (the default), the AzureRM provider configuration Object ID is used.."
|
description = "The Managed Service Identity ID used to create the service principal. If this value is null (the default), the AzureRM provider configuration Object ID is used.."
|
||||||
|
Loading…
x
Reference in New Issue
Block a user