Docker** Kubernetes [#s3f08f98]

Check !!!! 後でチェックする.[edit]

Install (CentOS8)[edit]

swap を止める[edit]

# swapoff -a

firewalld を止める.[edit]

routing の適用設定[edit]

本体のインストール[edit]

K8sリポジトリ(RHEL7)[edit]
RHEL7 ではなくて,最新版を手動で入れる.[edit]

cgroup の設定[edit]

クラスター構築[edit]

kubeadm[edit]
minikube[edit]

環境設定[edit]

仮想ネットワーク設定 CNI(calico)[edit]

Create a single-host Kubernetes cluster[edit]
kubectl create -f https://docs.projectcalico.org/manifests/tigera-operator.yaml
wget https://docs.projectcalico.org/manifests/custom-resources.yaml
vi custom-resources.yaml      (correct IP)
kubectl create -f custom-resources.yaml

watch kubectl get pods -n calico-system
kubectl taint nodes --all node-role.kubernetes.io/master-   (マスタノードでも Podを実行できるようになる)
kubectl get nodes -o wide
calicoctl[edit]
* 他の方法[edit]

Worker node[edit]

MetalLB Load Balancer[edit]

kubectl edit configmap -n kube-system kube-proxy
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/namespace.yaml
kubectl apply -f https://raw.githubusercontent.com/metallb/metallb/v0.9.3/manifests/metallb.yaml
kubectl get ns
kubectl get pod -n metallb-system
kubectl create secret generic -n metallb-system memberlist --from-literal=secretkey="$(openssl rand -base64 128)"
vi l2-configuration.yaml
kubectl apply -f l2-configuration.yaml
kubectl get service

Getting first[edit]

nginx[edit]

MetalLB を使用した場合[edit]
kubectl run nginx --image=nginx:1.11.3
kubectl get pod
kubectl expose pod nginx  --port=80 --type=LoadBalancer --name=nginx
kubectl get service
NAME         TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
kubernetes   ClusterIP      10.128.0.1      <none>        443/TCP        17m
nginx        LoadBalancer   10.128.44.222   172.22.1.70   80:32606/TCP   3m42s

OLD: nginx[edit]

Start[edit]
kubectl run nginx --image=nginx:1.11.3
kubectl get pod
kubectl expose pod nginx --external-ip=172.22.1.75  --port=80 
kubectl get service
NAME         TYPE        CLUSTER-IP       EXTERNAL-IP     PORT(S)   AGE
kubernetes   ClusterIP   10.128.0.1       <none>          443/TCP   15m
nginx        ClusterIP   10.128.175.104   192.168.27.43   80/TCP    3s
Stop[edit]
kubectl delete service nginx
kubectl get service
kubectl delete pod nginx
kubectl get pod
LoadBalancer[edit]
# kubectl expose pod nginx  --external-ip=172.22.1.75 --port=80 --type=LoadBalancer
# kubectl get service
NAME         TYPE           CLUSTER-IP      EXTERNAL-IP   PORT(S)        AGE
kubernetes   ClusterIP      10.96.0.1       <none>        443/TCP        80m
nginx        LoadBalancer   10.107.28.138   172.22.1.75   80:32348/TCP   4s
# kubectl expose pod nginx  --port=80 --type=LoadBalancer --name=nginx2
# kubectl get service
NAME         TYPE           CLUSTER-IP       EXTERNAL-IP   PORT(S)        AGE
kubernetes   ClusterIP      10.96.0.1        <none>        443/TCP        95m
nginx        LoadBalancer   10.107.28.138    172.22.1.75   80:32348/TCP   14m
nginx2       LoadBalancer   10.107.150.209   <pending>     80:31353/TCP   7s
spec:
   allocateLoadBalancerNodePorts: true
   clusterIP: 10.128.90.50
   clusterIPs:
   - 10.128.90.50
   externalIPs:
   - 192.168.27.43
   externalTrafficPolicy: Cluster
自分のIP以外でも指定可能[edit]
# kubectl expose pod nginx --port 80 --external-ip=192.168.27.44 --name=nginx2
# kubectl get service
NAME         TYPE        CLUSTER-IP       EXTERNAL-IP     PORT(S)   AGE
kubernetes   ClusterIP   10.128.0.1       <none>          443/TCP   67m
nginx        ClusterIP   10.128.175.104   192.168.27.43   80/TCP    51m
nginx2       ClusterIP   10.128.175.124   192.168.27.44   80/TCP    4m53s

JupyterHub[edit]


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 ページ一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2023-08-29 (火) 11:43:46