I am using Kubernetes on a coreOS cluster hosted on DigitalOcean. And using this repo to set it up. I started the apiserver with the following line:
/opt/bin/kube-apiserver --runtime-config=api/v1 --allow-privileged=true \
--insecure-bind-address=0.0.0.0 --insecure-port=8080 \
--secure-port=6443 --etcd-servers=http://127.0.0.1:2379 \
--logtostderr=true --advertise-address=${COREOS_PRIVATE_IPV4} \
--service-cluster-ip-range=10.100.0.0/16 --bind-address=0.0.0.0
The problem is that it accepts requests from anyone! I want to be able to provide a simple user/password authentication. I have been reading this and this and it seems that I have to do something like the below, but I cannot afford to take the cluster down for a long period of time, so I need your guys to help with this one. Btw, my pods do not create another pods, so I only need a few user, like 1/2 for devs and 1 for CI.
I am thinking of doing something like including authorization-mode and authorization-policy-file flags as it seems required and making the insecure-bind-address localhost to make it only available locally. I am missing something?
/opt/bin/kube-apiserver --runtime-config=api/v1 --allow-privileged=true \
--authorization-mode=ABAC --authorization-policy-file=/access.json \
--insecure-bind-address=127.0.0.1 --insecure-port=8080 \
--secure-port=6443 --etcd-servers=http://127.0.0.1:2379 \
--logtostderr=true --advertise-address=${COREOS_PRIVATE_IPV4} \
--service-cluster-ip-range=10.100.0.0/16 --bind-address=0.0.0.0
###/access.json
{"user":"admin"}
{"user":"wercker"}
{"user":"dev1"}
{"user":"dev2"}
But where are the passwords? How do I actually make the request with kubectl and curl or httpie?
kubectl -s="https://SERVER:6443" --username="admin" --password="PASSWORD" get pods -o wide
but I was expecting to have access the api withcurl --header "Authorization: (admin:PASSWORD)" --insecure http://SERVER:6443/api
with the (admin:PASSWORD) string encoded on base64 UTF-8 – Hedelman