Skip to content

Commit

Permalink
Remove deprecated (and removed in 1.19) flag and function --basic-aut…
Browse files Browse the repository at this point in the history
  • Loading branch information
floryut authored and LuckySB committed Jan 16, 2021
1 parent 53f2ac3 commit a84818a
Show file tree
Hide file tree
Showing 15 changed files with 6 additions and 103 deletions.
2 changes: 1 addition & 1 deletion docs/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ the Kubernetes [documentation](https://kubernetes.io/docs/tasks/access-applicati

Supported version is kubernetes-dashboard v2.0.x :

- Login options are : token/kubeconfig by default, basic can be enabled with `kube_basic_auth: true` inventory variable - not recommended because this requires ABAC api-server which is not tested by kubespray team
- Login option : token/kubeconfig by default
- Deployed by default in "kube-system" namespace, can be overridden with `dashboard_namespace: kubernetes-dashboard` in inventory,
- Only serves over https

Expand Down
8 changes: 0 additions & 8 deletions docs/vars.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,11 +214,3 @@ in the form of dicts of key-value pairs of configuration parameters that will be

* *helm_version* - Defaults to v3.x, set to a v2 version (e.g. `v2.16.1` ) to install Helm 2.x (will install Tiller!).
Picking v3 for an existing cluster running Tiller will leave it alone. In that case you will have to remove Tiller manually afterwards.

## User accounts

The variable `kube_basic_auth` is false by default, but if set to true, a user with admin rights is created, named `kube`.
The password can be viewed after deployment by looking at the file
`{{ credentials_dir }}/kube_user.creds` (`credentials_dir` is set to `{{ inventory_dir }}/credentials` by default). This contains a randomly generated
password. If you wish to set your own password, just precreate/modify this
file yourself or change `kube_api_pwd` var.
16 changes: 1 addition & 15 deletions inventory/prod/group_vars/k8s-cluster/k8s-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ kube_cert_dir: "{{ kube_config_dir }}/ssl"
# This is where all of the bearer tokens will be stored
kube_token_dir: "{{ kube_config_dir }}/tokens"

# This is where to save basic auth file
kube_users_dir: "{{ kube_config_dir }}/users"

kube_api_anonymous_auth: true

## Change this to use another Kubernetes version, e.g. a current beta release
Expand All @@ -37,19 +34,8 @@ kube_log_level: 2
# Directory where credentials will be stored
credentials_dir: "{{ inventory_dir }}/credentials"

# Users to create for basic auth in Kubernetes API via HTTP
# Optionally add groups for user
kube_api_pwd: "{{ lookup('password', credentials_dir + '/kube_user.creds length=15 chars=ascii_letters,digits') }}"
kube_users:
kube:
pass: "{{kube_api_pwd}}"
role: admin
groups:
- system:masters

## It is possible to activate / deactivate selected authentication methods (basic auth, static token auth)
## It is possible to activate / deactivate selected authentication methods (oidc, static token auth)
kube_oidc_auth: false
kube_basic_auth: false
# kube_token_auth: false


Expand Down
16 changes: 1 addition & 15 deletions inventory/s000/group_vars/k8s-cluster/k8s-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,6 @@ kube_cert_dir: "{{ kube_config_dir }}/ssl"
# This is where all of the bearer tokens will be stored
kube_token_dir: "{{ kube_config_dir }}/tokens"

# This is where to save basic auth file
kube_users_dir: "{{ kube_config_dir }}/users"

kube_api_anonymous_auth: true

## Change this to use another Kubernetes version, e.g. a current beta release
Expand All @@ -37,19 +34,8 @@ kube_log_level: 2
# Directory where credentials will be stored
credentials_dir: "{{ inventory_dir }}/credentials"

# Users to create for basic auth in Kubernetes API via HTTP
# Optionally add groups for user
kube_api_pwd: "{{ lookup('password', credentials_dir + '/kube_user.creds length=15 chars=ascii_letters,digits') }}"
kube_users:
kube:
pass: "{{kube_api_pwd}}"
role: admin
groups:
- system:masters

## It is possible to activate / deactivate selected authentication methods (basic auth, static token auth)
## It is possible to activate / deactivate selected authentication methods (oidc, static token auth)
kube_oidc_auth: false
kube_basic_auth: false
# kube_token_auth: false


Expand Down
16 changes: 1 addition & 15 deletions inventory/sample/group_vars/k8s-cluster/k8s-cluster.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ kube_cert_dir: "{{ kube_config_dir }}/ssl"
# This is where all of the bearer tokens will be stored
kube_token_dir: "{{ kube_config_dir }}/tokens"

# This is where to save basic auth file
kube_users_dir: "{{ kube_config_dir }}/users"

kube_api_anonymous_auth: true

## Change this to use another Kubernetes version, e.g. a current beta release
Expand All @@ -41,19 +38,8 @@ kube_log_level: 2
# Directory where credentials will be stored
credentials_dir: "{{ inventory_dir }}/credentials"

# Users to create for basic auth in Kubernetes API via HTTP
# Optionally add groups for user
kube_api_pwd: "{{ lookup('password', credentials_dir + '/kube_user.creds length=15 chars=ascii_letters,digits') }}"
kube_users:
kube:
pass: "{{kube_api_pwd}}"
role: admin
groups:
- system:masters

## It is possible to activate / deactivate selected authentication methods (basic auth, static token auth)
## It is possible to activate / deactivate selected authentication methods (oidc, static token auth)
# kube_oidc_auth: false
# kube_basic_auth: false
# kube_token_auth: false


Expand Down
2 changes: 1 addition & 1 deletion roles/kubernetes-apps/ansible/templates/dashboard.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ spec:
{% if dashboard_skip_login %}
- --enable-skip-login
{% endif %}
- --authentication-mode=token{% if kube_basic_auth|default(false) %},basic{% endif %}
- --authentication-mode=token
# Uncomment the following line to manually specify Kubernetes API server Host
# If not specified, Dashboard will attempt to auto discover the API server and connect
# to it. Uncomment only if the default does not work.
Expand Down
1 change: 0 additions & 1 deletion roles/kubernetes/master/defaults/main/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,6 @@ kube_apiserver_disable_admission_plugins: []
kube_api_runtime_config: []

## Enable/Disable Kube API Server Authentication Methods
kube_basic_auth: false
kube_token_auth: false
kube_oidc_auth: false
kube_webhook_token_auth: false
Expand Down
3 changes: 0 additions & 3 deletions roles/kubernetes/master/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
tags:
- k8s-pre-upgrade

- import_tasks: users-file.yml
when: kube_basic_auth|default(true)

- name: Create webhook token auth config
template:
src: webhook-token-auth-config.yaml.j2
Expand Down
15 changes: 0 additions & 15 deletions roles/kubernetes/master/tasks/users-file.yml

This file was deleted.

4 changes: 0 additions & 4 deletions roles/kubernetes/master/templates/known_users.csv.j2

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,6 @@ apiServer:
profiling: "{{ kube_profiling }}"
request-timeout: "{{ kube_apiserver_request_timeout }}"
enable-aggregator-routing: "{{ kube_api_aggregator_routing }}"
{% if kube_basic_auth|default(true) %}
basic-auth-file: {{ kube_users_dir }}/known_users.csv
{% endif %}
{% if kube_token_auth|default(true) %}
token-auth-file: {{ kube_token_dir }}/known_tokens.csv
{% endif %}
Expand Down Expand Up @@ -202,18 +199,13 @@ apiServer:
{% if kubelet_rotate_server_certificates %}
kubelet-certificate-authority: {{ kube_cert_dir }}/ca.crt
{% endif %}
{% if kubernetes_audit or kube_basic_auth|default(true) or kube_token_auth|default(true) or kube_webhook_token_auth|default(false) or ( cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws"] ) or apiserver_extra_volumes or ssl_ca_dirs|length %}
{% if kubernetes_audit or kube_token_auth|default(true) or kube_webhook_token_auth|default(false) or ( cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws"] ) or apiserver_extra_volumes or ssl_ca_dirs|length %}
extraVolumes:
{% if cloud_provider is defined and cloud_provider in ["openstack", "azure", "vsphere", "aws"] %}
- name: cloud-config
hostPath: {{ kube_config_dir }}/cloud_config
mountPath: {{ kube_config_dir }}/cloud_config
{% endif %}
{% if kube_basic_auth|default(true) %}
- name: basic-auth-config
hostPath: {{ kube_users_dir }}
mountPath: {{ kube_users_dir }}
{% endif %}
{% if kube_token_auth|default(true) %}
- name: token-auth-config
hostPath: {{ kube_token_dir }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ spec:
- --service-account-lookup=true
- --kubelet-preferred-address-types={{ kubelet_preferred_address_types }}
- --request-timeout={{ kube_apiserver_request_timeout }}
{% if kube_basic_auth|default(true) %}
- --basic-auth-file={{ kube_users_dir }}/known_users.csv
{% endif %}
- --tls-cert-file={{ kube_cert_dir }}/apiserver.pem
- --tls-private-key-file={{ kube_cert_dir }}/apiserver-key.pem
{% if kube_token_auth|default(true) %}
Expand Down
11 changes: 0 additions & 11 deletions roles/kubespray-defaults/defaults/main/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -133,24 +133,13 @@ kube_cert_compat_dir: "/etc/kubernetes/pki"
# This is where all of the bearer tokens will be stored
kube_token_dir: "{{ kube_config_dir }}/tokens"

# This is where to save basic auth file
kube_users_dir: "{{ kube_config_dir }}/users"


# This is the group that the cert creation scripts chgrp the
# cert files to. Not really changeable...
kube_cert_group: kube-cert

# Cluster Loglevel configuration
kube_log_level: 2

# Users to create for basic auth in Kubernetes API via HTTP
kube_api_pwd: "changeme"
kube_users:
kube:
pass: "{{kube_api_pwd}}"
role: admin

# Choose network plugin (cilium, calico, weave or flannel)
# Can also be set to 'cloud', which lets the cloud provider setup appropriate routing
kube_network_plugin: calico
Expand Down
1 change: 0 additions & 1 deletion tests/files/packet_ubuntu18-flannel-containerd-ha-once.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ cert_manager_enabled: true
metrics_server_enabled: false
metrics_server_kubelet_insecure_tls: true
kube_token_auth: true
kube_basic_auth: true
enable_nodelocaldns: false
1 change: 0 additions & 1 deletion tests/files/packet_ubuntu18-flannel-containerd-ha.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,4 @@ cert_manager_enabled: true
metrics_server_enabled: false
metrics_server_kubelet_insecure_tls: true
kube_token_auth: true
kube_basic_auth: true
enable_nodelocaldns: false

0 comments on commit a84818a

Please sign in to comment.