I followed the official guide to install and setup Kubernetes 1.0-release on Ubuntu. Here is the way to provision a privileged container.
- Switch to the Ubuntu directory
root@master: cd $KUBERNETES_HOME/cluster/ubuntu
- Modify a file under Ubuntu directory
vim util.sh
- Find two functions as following
create-kube-apiserver-opts create-kubelet-opts
- The functions above generate the options for kube-apiserver and kubelet, which apply the options while they are starting.
- Add a privileged flag in both of functions
andfunction create-kubelet-opts(){ cat <<EOF > ~/kube/default/kubelet KUBELET_OPTS="--address=0.0.0.0 \ --port=10250 \ --hostname_override=$1 \ --api_servers=http://$2:8080 \ --logtostderr=true \ --cluster_dns=$3 \ --cluster_domain=$4 \ --allow-privileged=true" EOF }
function create-kube-apiserver-opts(){ cat <<EOF > ~/kube/default/kube-apiserver KUBE_APISERVER_OPTS="--address=0.0.0.0 \ --port=8080 \ --etcd_servers=http://127.0.0.1:4001 \ --logtostderr=true \ --service-cluster-ip-range=${1} \ --admission_control=${2} \ --service_account_key_file=/tmp/kube-serviceaccount.key \ --allow-privileged=true \ --service_account_lookup=false " EOF }
- Then restart all the Kubernetes by executing following commands
root@master: cd $KUBERNETES_HOME/cluster root@master: KUBERNETES_PROVIDER=ubuntu ./kube-down.sh root@master: KUBERNETES_PROVIDER=ubuntu ./kube-up.sh
- Write a template of replication controller as following
- Create the replication controller and then the Pods would be launched