Difference between revisions of "IT-SDK-Kubernetes-YAML"

From wiki.samerhijazi.net
Jump to navigation Jump to search
(Installation and Configuration)
Line 20: Line 20:
 
== Basics of Kubernetes ==
 
== Basics of Kubernetes ==
 
== Installation and Configuration ==
 
== Installation and Configuration ==
 +
<pre class="code">
 +
root root $ sudo -i
 +
root $ root@lfs458-node-1a0a:~# apt-get update && apt-get upgrade -y
 +
root $ apt-get install -y docker.io
 +
root $ vim /etc/apt/sources.list.d/kubernetes.list
 +
# deb http://apt.kubernetes.io/ kubernetes-xenial main
 +
root $ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
 +
root $ apt-get install -y kubeadm=1.15.1-00 kubelet=1.15.1-00 kubectl=1.15.1-00
 +
root $ wget https://tinyurl.com/yb4xturm -O rbac-kdd.yaml
 +
root $ wget https://tinyurl.com/y8lvqc9g -O calico.yaml
 +
root $ ip addr show
 +
root $ vim kubeadm-config.yaml
 +
--------------------------------------
 +
apiVersion: kubeadm.k8s.io/v1beta2
 +
kind: ClusterConfiguration
 +
kubernetesVersion: 1.15.1 #<-- Use the word stable for newest version
 +
controlPlaneEndpoint: "k8smaster:6443" #<-- Use the node alias not the IP
 +
networking:
 +
podSubnet: 192.168.0.0/16 #<-- Match the IP range from the Calico config file
 +
--------------------------------------
 +
root $ kubeadm init --config=kubeadm-config.yaml --upload-certs | tee kubeadm-init.out # Save output for future review
 +
root $ exit
 +
 +
user $ mkdir -p $HOME/.kube
 +
</pre>
 +
user $ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
 +
user $ sudo chown $(id -u):$(id -g) $HOME/.kube/config
 +
user $ less .kube/config
 +
user $ sudo cp /root/rbac-kdd.yaml .
 +
user $ kubectl apply -f rbac-kdd.yaml
 +
user $ sudo cp /root/calico.yaml .
 +
user $ kubectl apply -f calico.yaml
 +
user $ source <(kubectl completion bash)
 +
user $ echo "source <(kubectl completion bash)" >> ~/.bashrc
 +
user $ kubectl des<Tab> n<Tab><Tab> lfs458-<Tab>
 +
user $ kubectl -n kube-s<Tab> g<Tab> po<Tab>
 +
user $ sudo kubeadm config print init-defaults
 +
 
== Kubernetes Architecture ==
 
== Kubernetes Architecture ==
 
== APIs and Access ==
 
== APIs and Access ==

Revision as of 22:49, 28 October 2019

Sammlung

  • Installation-Tools: kubeadm
  • SysReq: Master(3v CPU, 4G MeM, 5G Disk); Worker(1v CPU, 2G MeM, 5G Disk)

Linux-Admin

$ vi /etc/sudoers.d
# student ALL=(ALL) ALL
$ PATH=$PATH:/usr/sbin:/sbin
$ tar -xvf filename

Linux-Admin



Introduction

Basics of Kubernetes

Installation and Configuration

root root $ sudo -i
root $ root@lfs458-node-1a0a:~# apt-get update && apt-get upgrade -y
root $ apt-get install -y docker.io
root $ vim /etc/apt/sources.list.d/kubernetes.list
# deb http://apt.kubernetes.io/ kubernetes-xenial main
root $ curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
root $ apt-get install -y kubeadm=1.15.1-00 kubelet=1.15.1-00 kubectl=1.15.1-00
root $ wget https://tinyurl.com/yb4xturm -O rbac-kdd.yaml
root $ wget https://tinyurl.com/y8lvqc9g -O calico.yaml
root $ ip addr show
root $ vim kubeadm-config.yaml
--------------------------------------
apiVersion: kubeadm.k8s.io/v1beta2
kind: ClusterConfiguration
kubernetesVersion: 1.15.1 #<-- Use the word stable for newest version
controlPlaneEndpoint: "k8smaster:6443" #<-- Use the node alias not the IP
networking:
podSubnet: 192.168.0.0/16 #<-- Match the IP range from the Calico config file
--------------------------------------
root $ kubeadm init --config=kubeadm-config.yaml --upload-certs | tee kubeadm-init.out # Save output for future review
root $ exit

user $ mkdir -p $HOME/.kube

user $ sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config user $ sudo chown $(id -u):$(id -g) $HOME/.kube/config user $ less .kube/config user $ sudo cp /root/rbac-kdd.yaml . user $ kubectl apply -f rbac-kdd.yaml user $ sudo cp /root/calico.yaml . user $ kubectl apply -f calico.yaml user $ source <(kubectl completion bash) user $ echo "source <(kubectl completion bash)" >> ~/.bashrc user $ kubectl des<Tab> n<Tab><Tab> lfs458-<Tab> user $ kubectl -n kube-s<Tab> g<Tab> po<Tab> user $ sudo kubeadm config print init-defaults

Kubernetes Architecture

APIs and Access

API Objects

Managing State With Deployments

Services

Volumes and Data

Ingress

Scheduling

Logging and Troubleshooting

Custom Resource Definition

Helm

Security

High Availability