mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-07-27 05:27:21 +00:00
deprecate outdated param
This commit is contained in:
parent
c5bffaaf31
commit
a67be8e8ab
@ -19,6 +19,7 @@
|
|||||||
# Define all your cluster nodes, MASTER node comes first"
|
# Define all your cluster nodes, MASTER node comes first"
|
||||||
# And separated with blank space like <user_1@ip_1> <user_2@ip_2> <user_3@ip_3>
|
# And separated with blank space like <user_1@ip_1> <user_2@ip_2> <user_3@ip_3>
|
||||||
export nodes=${nodes:-"vcap@10.10.103.250 vcap@10.10.103.162 vcap@10.10.103.223"}
|
export nodes=${nodes:-"vcap@10.10.103.250 vcap@10.10.103.162 vcap@10.10.103.223"}
|
||||||
|
|
||||||
# Define all your nodes role: a(master) or i(minion) or ai(both master and minion), must be the order same
|
# Define all your nodes role: a(master) or i(minion) or ai(both master and minion), must be the order same
|
||||||
role=${role:-"ai i i"}
|
role=${role:-"ai i i"}
|
||||||
# If it practically impossible to set an array as an environment variable
|
# If it practically impossible to set an array as an environment variable
|
||||||
@ -36,7 +37,7 @@ export FLANNEL_NET=${FLANNEL_NET:-172.16.0.0/16}
|
|||||||
export FLANNEL_OPTS=${FLANNEL_OPTS:-"Network": 172.16.0.0/16}
|
export FLANNEL_OPTS=${FLANNEL_OPTS:-"Network": 172.16.0.0/16}
|
||||||
|
|
||||||
# Admission Controllers to invoke prior to persisting objects in cluster
|
# Admission Controllers to invoke prior to persisting objects in cluster
|
||||||
export ADMISSION_CONTROL=NamespaceLifecycle,NamespaceAutoProvision,LimitRanger,ServiceAccount,ResourceQuota
|
export ADMISSION_CONTROL=NamespaceLifecycle,NamespaceExists,LimitRanger,ServiceAccount,ResourceQuota,SecurityContextDeny
|
||||||
|
|
||||||
# Optional: Enable node logging.
|
# Optional: Enable node logging.
|
||||||
ENABLE_NODE_LOGGING=false
|
ENABLE_NODE_LOGGING=false
|
||||||
|
@ -25,7 +25,10 @@ if [ "${ENABLE_CLUSTER_DNS}" == true ]; then
|
|||||||
sed -e "s/{{ pillar\['dns_replicas'\] }}/${DNS_REPLICAS}/g;s/{{ pillar\['dns_domain'\] }}/${DNS_DOMAIN}/g;" "${KUBE_ROOT}/cluster/addons/dns/skydns-rc.yaml.in" > skydns-rc.yaml
|
sed -e "s/{{ pillar\['dns_replicas'\] }}/${DNS_REPLICAS}/g;s/{{ pillar\['dns_domain'\] }}/${DNS_DOMAIN}/g;" "${KUBE_ROOT}/cluster/addons/dns/skydns-rc.yaml.in" > skydns-rc.yaml
|
||||||
sed -e "s/{{ pillar\['dns_server'\] }}/${DNS_SERVER_IP}/g" "${KUBE_ROOT}/cluster/addons/dns/skydns-svc.yaml.in" > skydns-svc.yaml
|
sed -e "s/{{ pillar\['dns_server'\] }}/${DNS_SERVER_IP}/g" "${KUBE_ROOT}/cluster/addons/dns/skydns-svc.yaml.in" > skydns-svc.yaml
|
||||||
|
|
||||||
|
# use kubectl to create kube-system namespace
|
||||||
|
"${KUBE_ROOT}/cluster/kubectl.sh" create -f namespace.yaml
|
||||||
# use kubectl to create skydns rc and service
|
# use kubectl to create skydns rc and service
|
||||||
"${KUBE_ROOT}/cluster/kubectl.sh" --namespace=kube-system create -f skydns-rc.yaml
|
"${KUBE_ROOT}/cluster/kubectl.sh" --namespace=kube-system create -f skydns-rc.yaml
|
||||||
"${KUBE_ROOT}/cluster/kubectl.sh" --namespace=kube-system create -f skydns-svc.yaml
|
"${KUBE_ROOT}/cluster/kubectl.sh" --namespace=kube-system create -f skydns-svc.yaml
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
4
cluster/ubuntu/namespace.yaml
Normal file
4
cluster/ubuntu/namespace.yaml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: kube-system
|
@ -196,14 +196,14 @@ EOF
|
|||||||
|
|
||||||
function create-kube-apiserver-opts(){
|
function create-kube-apiserver-opts(){
|
||||||
cat <<EOF > ~/kube/default/kube-apiserver
|
cat <<EOF > ~/kube/default/kube-apiserver
|
||||||
KUBE_APISERVER_OPTS="--address=0.0.0.0 \
|
KUBE_APISERVER_OPTS="--insecure-bind-address=0.0.0.0 \
|
||||||
--port=8080 \
|
--insecure-port=8080 \
|
||||||
--etcd_servers=http://127.0.0.1:4001 \
|
--etcd-servers=http://127.0.0.1:4001 \
|
||||||
--logtostderr=true \
|
--logtostderr=true \
|
||||||
--service-cluster-ip-range=${1} \
|
--service-cluster-ip-range=${1} \
|
||||||
--admission_control=${2} \
|
--admission-control=${2} \
|
||||||
--client-ca-file=/srv/kubernetes/ca.crt
|
--client-ca-file=/srv/kubernetes/ca.crt \
|
||||||
--tls-cert-file=/srv/kubernetes/server.cert
|
--tls-cert-file=/srv/kubernetes/server.cert \
|
||||||
--tls-private-key-file=/srv/kubernetes/server.key"
|
--tls-private-key-file=/srv/kubernetes/server.key"
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
@ -211,7 +211,7 @@ EOF
|
|||||||
function create-kube-controller-manager-opts(){
|
function create-kube-controller-manager-opts(){
|
||||||
cat <<EOF > ~/kube/default/kube-controller-manager
|
cat <<EOF > ~/kube/default/kube-controller-manager
|
||||||
KUBE_CONTROLLER_MANAGER_OPTS="--master=127.0.0.1:8080 \
|
KUBE_CONTROLLER_MANAGER_OPTS="--master=127.0.0.1:8080 \
|
||||||
--root-ca-file=/srv/kubernetes/ca.crt
|
--root-ca-file=/srv/kubernetes/ca.crt \
|
||||||
--service-account-private-key-file=/srv/kubernetes/server.key \
|
--service-account-private-key-file=/srv/kubernetes/server.key \
|
||||||
--logtostderr=true"
|
--logtostderr=true"
|
||||||
EOF
|
EOF
|
||||||
@ -230,11 +230,11 @@ function create-kubelet-opts(){
|
|||||||
cat <<EOF > ~/kube/default/kubelet
|
cat <<EOF > ~/kube/default/kubelet
|
||||||
KUBELET_OPTS="--address=0.0.0.0 \
|
KUBELET_OPTS="--address=0.0.0.0 \
|
||||||
--port=10250 \
|
--port=10250 \
|
||||||
--hostname_override=$1 \
|
--hostname-override=$1 \
|
||||||
--api_servers=http://$2:8080 \
|
--api-servers=http://$2:8080 \
|
||||||
--logtostderr=true \
|
--logtostderr=true \
|
||||||
--cluster_dns=$3 \
|
--cluster-dns=$3 \
|
||||||
--cluster_domain=$4"
|
--cluster-domain=$4"
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ You can customize your etcd version, flannel version, k8s version by changing va
|
|||||||
|
|
||||||
Please make sure that there are `kube-apiserver`, `kube-controller-manager`, `kube-scheduler`, `kubelet`, `kube-proxy`, `etcd`, `etcdctl` and `flannel` in the binaries/master or binaries/minion directory.
|
Please make sure that there are `kube-apiserver`, `kube-controller-manager`, `kube-scheduler`, `kubelet`, `kube-proxy`, `etcd`, `etcdctl` and `flannel` in the binaries/master or binaries/minion directory.
|
||||||
|
|
||||||
> We used flannel here because we want to use overlay network, but please remember it is not the only choice, and it is also not a k8s' necessary dependence. Actually you can just build up k8s cluster natively, or use flannel, Open vSwitch or any other SDN tool you like, we just choose flannel here as a example.
|
> We used flannel here because we want to use overlay network, but please remember it is not the only choice, and it is also not a k8s' necessary dependence. Actually you can just build up k8s cluster natively, or use flannel, Open vSwitch or any other SDN tool you like, we just choose flannel here as an example.
|
||||||
|
|
||||||
#### Configure and start the Kubernetes cluster
|
#### Configure and start the Kubernetes cluster
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ The first variable `nodes` defines all your cluster nodes, MASTER node comes fir
|
|||||||
|
|
||||||
Then the `roles ` variable defines the role of above machine in the same order, "ai" stands for machine acts as both master and node, "a" stands for master, "i" stands for node. So they are just defined the k8s cluster as the table above described.
|
Then the `roles ` variable defines the role of above machine in the same order, "ai" stands for machine acts as both master and node, "a" stands for master, "i" stands for node. So they are just defined the k8s cluster as the table above described.
|
||||||
|
|
||||||
The `NUM_MINIONS` variable defines the total number of minion nodes.
|
The `NUM_MINIONS` variable defines the total number of nodes.
|
||||||
|
|
||||||
The `SERVICE_CLUSTER_IP_RANGE` variable defines the Kubernetes service IP range. Please make sure that you do have a valid private ip range defined here, because some IaaS provider may reserve private ips. You can use below three private network range according to rfc1918. Besides you'd better not choose the one that conflicts with your own private network range.
|
The `SERVICE_CLUSTER_IP_RANGE` variable defines the Kubernetes service IP range. Please make sure that you do have a valid private ip range defined here, because some IaaS provider may reserve private ips. You can use below three private network range according to rfc1918. Besides you'd better not choose the one that conflicts with your own private network range.
|
||||||
|
|
||||||
@ -116,11 +116,11 @@ The `SERVICE_CLUSTER_IP_RANGE` variable defines the Kubernetes service IP range.
|
|||||||
|
|
||||||
The `FLANNEL_NET` variable defines the IP range used for flannel overlay network, should not conflict with above `SERVICE_CLUSTER_IP_RANGE`.
|
The `FLANNEL_NET` variable defines the IP range used for flannel overlay network, should not conflict with above `SERVICE_CLUSTER_IP_RANGE`.
|
||||||
|
|
||||||
After all the above variable being set correctly. We can use below command in cluster/ directory to bring up the whole cluster.
|
After all the above variables being set correctly, we can use following command in cluster/ directory to bring up the whole cluster.
|
||||||
|
|
||||||
`$ KUBERNETES_PROVIDER=ubuntu ./kube-up.sh`
|
`$ KUBERNETES_PROVIDER=ubuntu ./kube-up.sh`
|
||||||
|
|
||||||
The scripts is automatically scp binaries and config files to all the machines and start the k8s service on them. The only thing you need to do is to type the sudo password when promoted. The current machine name is shown below like. So you will not type in the wrong password.
|
The scripts automatically scp binaries and config files to all the machines and start the k8s service on them. The only thing you need to do is to type the sudo password when promoted. The current machine name is shown below, so you will not type in the wrong password.
|
||||||
|
|
||||||
```console
|
```console
|
||||||
Deploying minion on machine 10.10.103.223
|
Deploying minion on machine 10.10.103.223
|
||||||
|
@ -81,7 +81,7 @@ kind: ServiceAccount
|
|||||||
metadata:
|
metadata:
|
||||||
name: build-robot
|
name: build-robot
|
||||||
EOF
|
EOF
|
||||||
$ kubectl create -f /tmp/serviceaccount.json
|
$ kubectl create -f /tmp/serviceaccount.yaml
|
||||||
serviceaccounts/build-robot
|
serviceaccounts/build-robot
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user