Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

enable RBAC on k8s by default #1962

Merged
merged 1 commit into from
Dec 21, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/clusterdefinition.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Here are the valid values for the orchestrator types:
|dnsServiceIP|no|IP address for kube-dns to listen on. If specified must be in the range of `serviceCidr`.|
|dockerBridgeSubnet|no|The specific IP and subnet used for allocating IP addresses for the docker bridge network created on the kubernetes master and agents. Default value is 172.17.0.1/16. This value is used to configure the docker daemon using the [--bip flag](https://docs.docker.com/engine/userguide/networking/default_network/custom-docker0).|
|serviceCidr|no|IP range for Service IPs, Default is "10.0.0.0/16". This range is never routed outside of a node so does not need to lie within clusterSubnet or the VNet.|
|enableRbac|no|Enable [Kubernetes RBAC](https://kubernetes.io/docs/admin/authorization/rbac/) (boolean - default == false) |
|enableRbac|no|Enable [Kubernetes RBAC](https://kubernetes.io/docs/admin/authorization/rbac/) (boolean - default == true) |
|enableAggregatedAPIs|no|Enable [Kubernetes Aggregated APIs](https://kubernetes.io/docs/concepts/api-extension/apiserver-aggregation/).This is required by [Service Catalog](https://github.com/kubernetes-incubator/service-catalog/blob/master/README.md). (boolean - default == false) |
|maxPods|no|The maximum number of pods per node. The minimum valid value, necessary for running kube-system pods, is 5. Default value is 30 when networkPolicy equals azure, 110 otherwise.|
|gcHighThreshold|no|Sets the --image-gc-high-threshold value on the kublet configuration. Default is 85. [See kubelet Garbage Collection](https://kubernetes.io/docs/concepts/cluster-administration/kubelet-garbage-collection/) |
Expand Down
6 changes: 3 additions & 3 deletions docs/kubernetes/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ Enable Managed Identity by adding `useManagedIdentity` in `kubernetesConfig`.

<a name="feat-managed-disks"></a>

## Optional: Enable Kubernetes Role-Based Access Control (RBAC)
## Optional: Disable Kubernetes Role-Based Access Control (RBAC)

By default, the cluster will be provisioned without [Role-Based Access Control](https://kubernetes.io/docs/admin/authorization/rbac/) enabled. Enable RBAC by adding `enableRbac` in `kubernetesConfig` in the api model:
By default, the cluster will be provisioned with [Role-Based Access Control](https://kubernetes.io/docs/admin/authorization/rbac/) enabled. Disable RBAC by adding `enableRbac` in `kubernetesConfig` in the api model:

```console
"kubernetesConfig": {
"enableRbac": true
"enableRbac": false
}
```

Expand Down
5 changes: 1 addition & 4 deletions examples/classic/kubernetes.classic.rbac.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
"apiVersion": "vlabs",
"properties": {
"orchestratorProfile": {
"orchestratorType": "Kubernetes",
"kubernetesConfig": {
"enableRbac": true
}
"orchestratorType": "Kubernetes"
},
"masterProfile": {
"count": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"orchestratorProfile": {
"orchestratorType": "Kubernetes",
"kubernetesConfig": {
"enableRbac": true,
"clusterSubnet": "10.239.0.0/16"
}
},
Expand Down
4 changes: 4 additions & 0 deletions pkg/acsengine/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,10 @@ func setOrchestratorDefaults(cs *api.ContainerService) {
staticLinuxKubeletConfig["--cloud-provider"] = "external"
}

if a.OrchestratorProfile.KubernetesConfig.EnableRbac == nil {
a.OrchestratorProfile.KubernetesConfig.EnableRbac = pointerToBool(api.DefaultRBACEnabled)
}

// Override default --network-plugin?
if o.KubernetesConfig.NetworkPolicy == NetworkPolicyNone {
o.KubernetesConfig.KubeletConfig["--network-plugin"] = NetworkPluginKubenet
Expand Down
2 changes: 2 additions & 0 deletions pkg/api/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ const (
DefaultDashboardAddonEnabled = true
// DefaultReschedulerAddonEnabled determines the acs-engine provided default for enabling kubernetes-rescheduler addon
DefaultReschedulerAddonEnabled = false
// DefaultRBACEnabled determines the acs-engine provided default for enabling kubernetes RBAC
DefaultRBACEnabled = true
// DefaultTillerAddonName is the name of the tiller addon deployment
DefaultTillerAddonName = "tiller"
// DefaultACIConnectorAddonName is the name of the tiller addon deployment
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ type KubernetesConfig struct {
CustomCcmImage string `json:"customCcmImage,omitempty"` // Image for cloud-controller-manager
UseCloudControllerManager *bool `json:"useCloudControllerManager,omitempty"`
UseInstanceMetadata *bool `json:"useInstanceMetadata,omitempty"`
EnableRbac bool `json:"enableRbac,omitempty"`
EnableRbac *bool `json:"enableRbac,omitempty"`
EnableAggregatedAPIs bool `json:"enableAggregatedAPIs,omitempty"`
GCHighThreshold int `json:"gchighthreshold,omitempty"`
GCLowThreshold int `json:"gclowthreshold,omitempty"`
Expand Down
2 changes: 1 addition & 1 deletion pkg/api/vlabs/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ type KubernetesConfig struct {
CustomCcmImage string `json:"customCcmImage,omitempty"`
UseCloudControllerManager *bool `json:"useCloudControllerManager,omitempty"`
UseInstanceMetadata *bool `json:"useInstanceMetadata,omitempty"`
EnableRbac bool `json:"enableRbac,omitempty"`
EnableRbac *bool `json:"enableRbac,omitempty"`
EnableAggregatedAPIs bool `json:"enableAggregatedAPIs,omitempty"`
GCHighThreshold int `json:"gchighthreshold,omitempty"`
GCLowThreshold int `json:"gclowthreshold,omitempty"`
Expand Down
6 changes: 4 additions & 2 deletions pkg/api/vlabs/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,10 @@ func (o *OrchestratorProfile) Validate(isUpdate bool) error {
"1.7.0", o.OrchestratorVersion)
}

if !o.KubernetesConfig.EnableRbac {
return fmt.Errorf("enableAggregatedAPIs requires the enableRbac feature as a prerequisite")
if o.KubernetesConfig.EnableRbac != nil {
if !*o.KubernetesConfig.EnableRbac {
return fmt.Errorf("enableAggregatedAPIs requires the enableRbac feature as a prerequisite")
}
}
}
}
Expand Down