Skip to content

Commit fe559bc

Browse files
committed
Add basic auth
1 parent eac707f commit fe559bc

File tree

4 files changed

+18
-7
lines changed

4 files changed

+18
-7
lines changed

k8s.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,11 @@
66
k8s_version: v1.2.0
77
k8s_num_nodes: 2
88
k8s_security_group_name: k8s
9-
k8s_node_prefix: k8s
9+
k8s_node_prefix: bar
10+
k8s_username: foobar
11+
k8s_password: FdKPSuwQ
1012
# This template name is specific to http://exoscale.ch, replace it
11-
k8s_template: Linux CoreOS stable 723 64-bit 10G Disk (2015-08-04-600521)
13+
k8s_template: Linux CoreOS stable 899 64-bit 50G Disk (2016-04-05-d6cdbb)
1214
k8s_instance_type: Tiny
1315

1416
roles:

roles/k8s/tasks/create_context.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
# Create k8s context
22

33
- name: Set context cluster
4-
command: kubectl config set-cluster exo --server=http://{{ k8s_master.default_ip }}:8080 --insecure-skip-tls-verify=true
4+
command: kubectl config set-cluster exo --server=https://{{ k8s_master.default_ip }}:443 --insecure-skip-tls-verify=true
55
tags: context
66

7+
- name: Set context user
8+
command: kubectl config set-credentials exo --username={{ k8s_username }} --password={{ k8s_password}}
9+
710
- name: Create context
8-
command: kubectl config set-context exo --cluster=exo
11+
command: kubectl config set-context exo --cluster=exo --user=exo
912

1013
- name: Use context
1114
command: kubectl config use-context exo

roles/k8s/tasks/create_secgroup_rules.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@
7676
end_port: 8080
7777
user_security_group: "{{ k8s_security_group_name }}"
7878

79-
- name: k8s public 8080
79+
- name: k8s public secure
8080
local_action:
8181
module: cs_securitygroup_rule
8282
security_group: "{{ k8s_security_group_name }}"
83-
start_port: 8080
84-
end_port: 8080
83+
start_port: 443
84+
end_port: 443

roles/k8s/templates/k8s-master.j2

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@ write-files:
77
content: |
88
OPTS_RPC_MOUNTD=""
99

10+
- path: /srv/kubernetes/basicauth.csv
11+
permissions: '0644'
12+
content: |
13+
{{ k8s_password }},{{ k8s_username }},1
14+
1015
- path: /opt/bin/wupiao
1116
permissions: '0755'
1217
content: |
@@ -149,6 +154,7 @@ coreos:
149154
ExecStart=/opt/bin/kube-apiserver \
150155
--service-account-key-file=/opt/bin/kube-serviceaccount.key \
151156
--service-account-lookup=false \
157+
--basic-auth-file=/srv/kubernetes/basicauth.csv \
152158
--admission-control=NamespaceLifecycle,NamespaceAutoProvision,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota \
153159
--runtime-config=api/v1 \
154160
--allow-privileged=true \

0 commit comments

Comments
 (0)