Privileged containers provisioning by Kubernetes in Ubuntu

I followed the official guide to install and setup Kubernetes 1.0-release on Ubuntu. Here is the way to provision a privileged container.

  1. Switch to the Ubuntu directory
    root@master: cd $KUBERNETES_HOME/cluster/ubuntu
  2. Modify a file under Ubuntu directory
    vim util.sh
  3. Find two functions as following
    create-kube-apiserver-opts
    create-kubelet-opts
  4. The functions above generate the options for kube-apiserver and kubelet, which apply the options while they are starting.
  5. Add a privileged flag in both of functions
    function 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
    }
    and
    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
    }
  6. 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
  7. Write a template of replication controller as following
  8. Create the replication controller and then the Pods would be launched
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值