-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
salt: Generate custom kubeconfig for Salt Master
Instead of using the `/etc/kubernetes/admin.conf` file which points to a specific master's `kube-apiserver` instance, we generate another one dedicated to Salt Master, and configure it to point to the local `apiserver-proxy` (which can then route to other masters if the local one isn't available). In addition, this kubeconfig generates its own certificate, which could later map to another group (and thus, other (Cluster)Role(s) than the current "system:masters"). Note that we reduce the unneeded `/etc/kubernetes` mount to `/etc/kubernetes/pki` (for SA signing key and etcd encryption key) in both Salt Master and Salt API containers (SaltAPI didn't need it since 41ba749). Fixes: #2533
- Loading branch information
Showing
6 changed files
with
31 additions
and
11 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
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
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,18 @@ | ||
{%- from "metalk8s/map.jinja" import kube_api with context %} | ||
{%- from "metalk8s/map.jinja" import kubernetes with context %} | ||
include: | ||
- metalk8s.internal.m2crypto | ||
Create kubeconfig file for Salt Master: | ||
metalk8s_kubeconfig.managed: | ||
- name: /etc/salt/master-kubeconfig.conf | ||
- ca_server: {{ pillar['metalk8s']['ca']['minion'] }} | ||
- signing_policy: {{ kube_api.cert.client_signing_policy }} | ||
- client_cert_info: | ||
CN: "salt-master-{{ grains.id }}" | ||
O: "system:masters" | ||
- apiserver: "https://127.0.0.1:7443" | ||
- cluster: {{ kubernetes.cluster }} | ||
- require: | ||
- metalk8s_package_manager: Install m2crypto |