Kubernetes: Configuração do Cluster Kubernetes Standard

From Wiki
Revision as of 14:18, 21 August 2019 by Ebasso (talk | contribs) (Criou a página com "= Configuração do Cluster Kubernetes sem HA = == Create a kubeadm-config.yaml == Criar arquivo kubeadm-config.yaml, com o conteúdo: <nowiki>apiVersion: kubeadm.k8s.io...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Configuração do Cluster Kubernetes sem HA

Create a kubeadm-config.yaml

Criar arquivo kubeadm-config.yaml, com o conteúdo:

apiVersion: kubeadm.k8s.io/v1alpha2
kind: MasterConfiguration
apiServerExtraArgs:
  enable-admission-plugins: PodSecurityPolicy
kubernetesVersion: v1.11.9
networking:
    # This CIDR is a Calico default. Substitute or remove for your CNI provider.
    podSubnet: "192.168.0.0/16"


Initialize the master.

kubeadm init --config=kubeadm-config.yaml

To make kubectl work,

mkdir -p $HOME/.kube
cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
chown $(id -u):$(id -g) $HOME/.kube/config

Anote a mensagem com o token para adicionar os demais nodes

kubeadm join --token token master-ip:master-port --discovery-token-ca-cert-hash sha256:hash

For HCL Component pack

If you enabled the PodSecurityPolicy admission plugin in step 6, then you need to download the Component Pack installation zip to the master node, extract the file privileged-psp-with-rbac.yaml and apply it so that system pods are able to start in the kube-system namespace:

unzip -p IC-ComponentPack-6.0.0.8.zip 
cd microservices_connections/hybridcloud/support/psp/

To allow system pods to start in the kube-system namespace, apply the yaml file:

kubectl apply -f privileged-psp-with-rbac.yaml

Instalar o Calico Network

kubectl apply -f https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml
kubectl apply -f https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/kubernetes-datastore/calico-networking/1.7/calico.yaml

Após a configuração, veja o artigo Kubernetes: Verificando o estado do Kubernetes após a configuração, este tópico inclui debug o Calico.

Adicionar os demais nodes

Execute o comando com o token para adicionar os demais nodes

kubeadm join --token token master-ip:master-port --discovery-token-ca-cert-hash sha256:hash

Ver também