-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rbac aad practice #16
Open
JouHouFin
wants to merge
3
commits into
smaddis:master
Choose a base branch
from
smaddis:rbac-aad-practice
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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 |
---|---|---|
|
@@ -75,8 +75,11 @@ resource "azurerm_kubernetes_cluster" "k8s_cluster" { | |
|
||
addon_profile { | ||
oms_agent { | ||
enabled = true | ||
log_analytics_workspace_id = azurerm_log_analytics_workspace.log_analytics_ws.id | ||
enabled = true | ||
log_analytics_workspace_id = azurerm_log_analytics_workspace.log_analytics_ws.id | ||
} | ||
kube_dashboard { | ||
enabled = true | ||
} | ||
} | ||
|
||
|
@@ -85,6 +88,16 @@ resource "azurerm_kubernetes_cluster" "k8s_cluster" { | |
network_plugin = "kubenet" | ||
} | ||
|
||
role_based_access_control { | ||
enabled = true | ||
azure_active_directory { | ||
managed = true | ||
admin_group_object_ids = [ | ||
"93b4062c-6cf4-4ed3-af28-9633d2785bda" | ||
] | ||
} | ||
} | ||
|
||
Comment on lines
+91
to
+100
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is one essential part of enabling AAD integration for K8S cluster. |
||
tags = { | ||
environment = var.environment | ||
} | ||
|
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
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
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,9 @@ | ||
This module installs Azure Key Vault Provider for | ||
Kubernetes Secrets Store CSI Driver. | ||
|
||
Installation is done with Helm. | ||
|
||
TODO: Document variables | ||
TODO: Document module usage | ||
TODO: Document outputs | ||
TODO: Change kube_config and config_context to use variables. |
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,24 @@ | ||
provider "helm" { | ||
kubernetes { | ||
config_path = "~/.kube/config" # Replace if you have different kubeconfig path! | ||
config_context = "rbackuksatrng-k8stest-cluster-admin" # Replace with your admin context name! | ||
# host = var.k8s_host | ||
# username = var.k8s_username | ||
# password = var.k8s_password | ||
client_certificate = base64decode(var.k8s_client_cert) | ||
client_key = base64decode(var.k8s_client_key) | ||
cluster_ca_certificate = base64decode(var.k8s_cluster_ca_cert) | ||
} | ||
} | ||
|
||
|
||
resource "helm_release" "kv_azure_csi" { | ||
name = "csi-secrets-provider-azure" | ||
repository = var.repository | ||
chart = "csi-secrets-store-provider-azure" | ||
version = var.csi_provider_version | ||
# In which K8S namespace the Azure provider for CSI driver should be installed. | ||
# TODO: Should this be the same namespace as where the actual application is deployed. | ||
namespace = var.namespace | ||
create_namespace = true | ||
} |
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,44 @@ | ||
variable "environment" { | ||
default = "development" | ||
} | ||
|
||
variable "location" { | ||
default = "West Europe" | ||
} | ||
|
||
variable "project_name" { | ||
default = "rbackuksatrng" | ||
} | ||
|
||
# See secrets-store-csi-driver-provider-azure documentation, e.g. for version information. | ||
# https://github.com/Azure/secrets-store-csi-driver-provider-azure/blob/master/charts/csi-secrets-store-provider-azure/README.md | ||
variable "csi_provider_version" { | ||
default = "0.0.13" | ||
} | ||
|
||
# Repository where Helm charts for 'csi-secrets-provider-azure' are hosted. | ||
# Note: 'master'-branch is used since helm_release will parse 'index.yaml' located in repo. | ||
# Despite the 'master' -branch, 'index.yaml' contains only stable version releases. | ||
variable "repository" { | ||
default = "https://raw.githubusercontent.com/Azure/secrets-store-csi-driver-provider-azure/master/charts" | ||
} | ||
|
||
# Kubernetes connection details for Helm | ||
# Note: certs and key will be decoded from base64 in modules main.tf. | ||
# Don't decode them manually. | ||
# Supply raw values provided by e.g. | ||
# 'azurerm_kubernetes_cluster.aks.kube_config.0.client_certificate' | ||
# 'azurerm_kubernetes_cluster.aks.kube_config.0.client_key' | ||
# 'azurerm_kubernetes_cluster.aks.kube_config.0.cluster_ca_certificate' | ||
variable "k8s_host" {} | ||
variable "k8s_username" {} | ||
variable "k8s_password" {} | ||
variable "k8s_client_cert" {} | ||
variable "k8s_client_key" {} | ||
variable "k8s_cluster_ca_cert" {} | ||
|
||
# In which K8S namespace the Azure provider for CSI driver should be installed. | ||
# TODO: Should this be the same namespace as where the actual application is deployed. | ||
variable "namespace" { | ||
default = "kuksacloud" | ||
} |
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,9 @@ | ||
This module is used create a Azure Key Vault to store | ||
secrets used e.g. in K8S Deployment configurations. | ||
Note that an identity of K8S Kubelet service (kubelet_object_id) | ||
needs to be allowed read access to the created Key Vault, before | ||
K8S Deployments can fetch secrets from the vault. | ||
|
||
TODO: Document variables | ||
TODO: Document module usage (how to define identities for read access) | ||
TODO: Document outputs |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These steps document how to enable AAD-assisted RBAC in K8S cluster