use setup-container.sh and setup-kubetools.sh and nothing else
This commit is contained in:
parent
36c4472664
commit
9ab48fd2b7
@ -1,10 +0,0 @@
|
|||||||
kind: Role
|
|
||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
||||||
metadata:
|
|
||||||
namespace: staff
|
|
||||||
name: staff
|
|
||||||
rules:
|
|
||||||
- apiGroups: ["", "extensions", "apps"]
|
|
||||||
resources: ["deployments", "replicasets", "pods"]
|
|
||||||
verbs: ["list", "get", "watch", "create", "update", "patch", "delete"]
|
|
||||||
|
|
||||||
@ -1,36 +0,0 @@
|
|||||||
kind: ClusterRole
|
|
||||||
apiVersion: rbac.authorization.k8s.io/v1
|
|
||||||
metadata:
|
|
||||||
name: traefik-ingress-controller
|
|
||||||
rules:
|
|
||||||
- apiGroups:
|
|
||||||
- ""
|
|
||||||
resources:
|
|
||||||
- services
|
|
||||||
- endpoints
|
|
||||||
- secrets
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- list
|
|
||||||
- watch
|
|
||||||
- apiGroups:
|
|
||||||
- extensions
|
|
||||||
resources:
|
|
||||||
- ingresses
|
|
||||||
verbs:
|
|
||||||
- get
|
|
||||||
- list
|
|
||||||
- watch
|
|
||||||
---
|
|
||||||
kind: ClusterRoleBinding
|
|
||||||
apiVersion: rbac.authorization.k8s.io/v1
|
|
||||||
metadata:
|
|
||||||
name: traefik-ingress-controller
|
|
||||||
roleRef:
|
|
||||||
apiGroup: rbac.authorization.k8s.io
|
|
||||||
kind: ClusterRole
|
|
||||||
name: traefik-ingress-controller
|
|
||||||
subjects:
|
|
||||||
- kind: ServiceAccount
|
|
||||||
name: traefik-ingress-controller
|
|
||||||
namespace: kube-system
|
|
||||||
10
init2.yaml
10
init2.yaml
@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
apiVersion: v1
|
|
||||||
kind: Service
|
|
||||||
metadata:
|
|
||||||
name: myservice
|
|
||||||
spec:
|
|
||||||
ports:
|
|
||||||
- protocol: TCP
|
|
||||||
port: 80
|
|
||||||
targetPort: 9376
|
|
||||||
@ -1,69 +0,0 @@
|
|||||||
nmtui
|
|
||||||
exit
|
|
||||||
systemctl disable --now firewalld
|
|
||||||
ssh worker1
|
|
||||||
ssh worker2
|
|
||||||
ssh worker3
|
|
||||||
vim /etc/fstab
|
|
||||||
yum install -y git
|
|
||||||
git clone https://github.com/sandervanvugt/cka
|
|
||||||
cd cka
|
|
||||||
ls
|
|
||||||
vim setup-docker.sh
|
|
||||||
./setup-docker.sh
|
|
||||||
vim setup-kubetools.sh
|
|
||||||
./setup-kubetools.sh
|
|
||||||
./counter.sh 10
|
|
||||||
kubeadm init
|
|
||||||
ls
|
|
||||||
vim join-net.sh
|
|
||||||
su - student
|
|
||||||
usermod -aG wheel student
|
|
||||||
su - student
|
|
||||||
ls
|
|
||||||
scp join-net worker1:/root
|
|
||||||
scp join-net.sh worker1:/root
|
|
||||||
scp join-net.sh worker2:/root
|
|
||||||
scp join-net.sh worker3:/root
|
|
||||||
ssh worker1
|
|
||||||
kubectl get nodes
|
|
||||||
history
|
|
||||||
su - student
|
|
||||||
./counter.sh 20
|
|
||||||
vim ex1.yaml
|
|
||||||
kubectl api-resources
|
|
||||||
exit
|
|
||||||
vim /etc/hosts
|
|
||||||
vi /etc/hosts
|
|
||||||
yum install -y vim; yum update -y
|
|
||||||
systemctl status firewalld
|
|
||||||
systemctl disable --now firewalld
|
|
||||||
ppppppoweroff
|
|
||||||
poweroff
|
|
||||||
cd /etc/yum.repos.d/
|
|
||||||
ls
|
|
||||||
vim kubernetes.repo
|
|
||||||
yum repolist
|
|
||||||
yum provides */etcdctl
|
|
||||||
rpm -qa | grep etcd
|
|
||||||
yum install -y etcd
|
|
||||||
etcdctl -h
|
|
||||||
etcdctl backup -h
|
|
||||||
etcdctl snapshot -h
|
|
||||||
etcdctl snapshot save -h
|
|
||||||
etcdctl snapshot save --help
|
|
||||||
ETCDCTL_API=3 etcdctl snapshot save --help
|
|
||||||
ETCDCTL_API=3 etcdctl --endpoints=localhost:2379 --cacert /etc/kubernetes/pki/etcd/ca.crt --cert /etc/kubernetes/pki/etcd/server.crt --key /etc/kubernetes/pki/etcd/server.key get / --prefix --keys-only
|
|
||||||
ETCDCTL_API=3 etcdctl --endpoints=localhost:2379 --cacert /etc/kubernetes/pki/etcd/ca.crt --cert /etc/kubernetes/pki/etcd/server.crt --key /etc/kubernetes/pki/etcd/server.key snapshot save /tmp/snapshot.db
|
|
||||||
history
|
|
||||||
ps aux | grep etcd
|
|
||||||
history
|
|
||||||
ETCDCTL_API=3 etcdctl -h
|
|
||||||
cd
|
|
||||||
history
|
|
||||||
exit
|
|
||||||
systemctl status kubelet
|
|
||||||
exit
|
|
||||||
cd /etc/kubernetes/manifests/
|
|
||||||
ls
|
|
||||||
exit
|
|
||||||
@ -1,254 +0,0 @@
|
|||||||
# this is an unedited copy of the student history file used in the
|
|
||||||
# live class I've done on Jan. 16/17 2020. Use at your own risk
|
|
||||||
|
|
||||||
mkdir -p .kube
|
|
||||||
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
|
|
||||||
exit
|
|
||||||
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
|
|
||||||
sudo chown $(id -u):$(id -g) $HOME/.kube/config
|
|
||||||
cd .kube/
|
|
||||||
ls -l
|
|
||||||
cat config
|
|
||||||
kubectl get all
|
|
||||||
kubectl get nodes
|
|
||||||
cd
|
|
||||||
kubectl get pods -n kube-system
|
|
||||||
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
|
|
||||||
kubectl get pods -n kube-system
|
|
||||||
sysctl -a | grep bridge-nf-call-iptables
|
|
||||||
exit
|
|
||||||
kubectl get nodes
|
|
||||||
ssh root@worker2
|
|
||||||
ssh root@worker3
|
|
||||||
kubectl get nodes
|
|
||||||
exit
|
|
||||||
cat /etc/hosts
|
|
||||||
su -
|
|
||||||
kubectl api-resources
|
|
||||||
kubectl api-resources | less
|
|
||||||
kubectl get ns
|
|
||||||
kubectl create namespace mynamespace
|
|
||||||
kubectl create -h | less
|
|
||||||
kubectl create namespace -h
|
|
||||||
kubect get ns
|
|
||||||
kubectl get ns
|
|
||||||
kubectl explain pod
|
|
||||||
kubectl explain pod.metadata
|
|
||||||
git clone https://github.com/sandervanvugt/cka
|
|
||||||
cd cka
|
|
||||||
ls
|
|
||||||
vim ex1.yaml
|
|
||||||
kubectl create -f ex1.yaml
|
|
||||||
kubectl get pods
|
|
||||||
kubectl get pods -n mynamespace
|
|
||||||
kubectl get pods --all-namespaces
|
|
||||||
kubectl completion bash > ~/.kube/completion.bash.inc
|
|
||||||
history
|
|
||||||
cat ex1.yaml
|
|
||||||
kubectl create deployment --image=busybox
|
|
||||||
kubectl create deployment failin --image=busybox
|
|
||||||
kubectl get pods
|
|
||||||
vim exam.txt
|
|
||||||
./counter.sh 10
|
|
||||||
vim ex4.yaml
|
|
||||||
kubectl create -f ex4.yaml
|
|
||||||
vim ex4.yaml
|
|
||||||
kubectl create -f ex4.yaml
|
|
||||||
vim ex4.yaml
|
|
||||||
kubectl create -f ex4.yaml
|
|
||||||
cat ex4.yaml
|
|
||||||
vim ex4.yaml
|
|
||||||
kubectl get pods
|
|
||||||
kubectl describe pods myapp-pod
|
|
||||||
cp ex4.yaml ex4b.yaml
|
|
||||||
vim ex4b.yaml
|
|
||||||
kubectl create -f ex4b.yaml; kubectl get pods
|
|
||||||
kubectl get pods
|
|
||||||
ls
|
|
||||||
cat ex1.yaml
|
|
||||||
kubectl create deploy nginx-ex5 --image=nginx --replicas=5
|
|
||||||
kubectl run deploy nginx-ex5 --image=nginx --replicas=5
|
|
||||||
kubectl create deploy nginx-ex5b --image=nginx
|
|
||||||
kubectl edit deploy nginx-ex5b
|
|
||||||
kubectl get pods
|
|
||||||
kubectl scale deployment nginx-ex5b --replicas=5
|
|
||||||
kubectl run mydeploy --image busybox --command sleep 10000 --replicas 3 --dry-run -o yaml > mydep.yaml
|
|
||||||
vim mydep.yaml
|
|
||||||
kubectl create -f mydep.yaml
|
|
||||||
vim mydep.yaml
|
|
||||||
kubectl get all --selector run=mydeploy
|
|
||||||
kubectl delete deployment mydeploy
|
|
||||||
history
|
|
||||||
kubectl get nodes
|
|
||||||
kubectl explain pod.spec | less
|
|
||||||
kubectl explain pod.spec.volumes | less
|
|
||||||
cd cka/
|
|
||||||
ls
|
|
||||||
cd ..
|
|
||||||
git clone https://github.com/sandervanvugt/ckad
|
|
||||||
cd ckad/
|
|
||||||
ls
|
|
||||||
vim pv.yaml
|
|
||||||
kubectl create -f pv.yaml
|
|
||||||
kubectl get pv
|
|
||||||
vim pvc.yaml
|
|
||||||
kubectl create -f pvc.yaml
|
|
||||||
kubectl get pvc
|
|
||||||
kubectl get pv
|
|
||||||
vim pv-pod.yaml
|
|
||||||
kubectl explain pv.spec
|
|
||||||
kubectl explain pv.spec.emptydir
|
|
||||||
kubectl explain pod.spec.volumes.emptydir
|
|
||||||
kubectl explain pod.spec.volumes.emptyDir
|
|
||||||
kubectl explain pv.spec.emptyDir
|
|
||||||
vim pv.yaml
|
|
||||||
kubectl create -f pv.yaml
|
|
||||||
vim pv.yaml
|
|
||||||
kubectl get pv
|
|
||||||
kubectl get pv pv-volume -o yaml > ex7.yaml
|
|
||||||
vim ex7.yaml
|
|
||||||
kubectl create -f ex7.yaml
|
|
||||||
kubectl get pv emtpy-volume -o yaml
|
|
||||||
kubectl explain persistentvolume.spec.persistentvolumereclaimpolicy
|
|
||||||
kubectl explain persistentvolume.spec.persistentVolumeReclaimPolicy
|
|
||||||
vim pv-pod.yaml
|
|
||||||
kubectl create secret generic ex8-secret --from-literal=userpw=s3crt3tPW
|
|
||||||
kubectl get secret ex8-secret -o yaml
|
|
||||||
cd ../cka
|
|
||||||
ls
|
|
||||||
cd ../ckad/
|
|
||||||
ls
|
|
||||||
cd ../cka
|
|
||||||
vim ex8-pod.yaml
|
|
||||||
kubectl get pv
|
|
||||||
kubectl get secret
|
|
||||||
vim ex8-pod.yaml
|
|
||||||
kubectl create -f ex8-pod.yaml
|
|
||||||
vim ex8-pod.yaml
|
|
||||||
kubectl create -f ex8-pod.yaml
|
|
||||||
kubectl get pods
|
|
||||||
kubectl exec -it secret-test-pod -- /bin/bash
|
|
||||||
kubectl get secret
|
|
||||||
kubectl get secret ex8-secret -o yaml
|
|
||||||
./counter.sh 10
|
|
||||||
kubectl get pods -n kube-system
|
|
||||||
sudo docker ps
|
|
||||||
sudo ps aux | grep etcd
|
|
||||||
sudo find / -name "etcdctl"
|
|
||||||
sudo etcdctl
|
|
||||||
sudo yum provides etcdctl
|
|
||||||
ping 8.8.8.8
|
|
||||||
sudo -i
|
|
||||||
source <(kubectl completion bash)
|
|
||||||
kubectl -h | less
|
|
||||||
kubectl cordon -h | less
|
|
||||||
kubectl drain -h | less
|
|
||||||
sudo yum install -y bash-completion
|
|
||||||
source <(kubectl completion bash)
|
|
||||||
kubectl get nodes
|
|
||||||
kubectl cordon worker2.example.com
|
|
||||||
kubectl get nodes
|
|
||||||
kubectl uncordon worker2.example.com
|
|
||||||
kubectl get nodes
|
|
||||||
kubectl drain worker2.example.com
|
|
||||||
exit
|
|
||||||
source <(kubectl completion bash)
|
|
||||||
echo "source <(kubectl completion bash)" >> > ~/.bashrc
|
|
||||||
echo "source <(kubectl completion bash)" >> ~/.bashrc
|
|
||||||
exit
|
|
||||||
cd ckad/
|
|
||||||
./countdown 20
|
|
||||||
grep busybox2 *
|
|
||||||
vim busybox.yaml
|
|
||||||
kubectl create -f busybox.yaml
|
|
||||||
exit
|
|
||||||
kubectl get pods
|
|
||||||
kubectl get svc
|
|
||||||
kubectl exec -it busybox2 -- nslookup kubernetes
|
|
||||||
cd cka
|
|
||||||
ls
|
|
||||||
vim pod-and-service-dns.yaml
|
|
||||||
kubectl create -f pod-and-service-dns.yaml
|
|
||||||
kubectl exec -it busybox22 -- nslookup default-subdomain
|
|
||||||
kubectl exec -it busybox22 -- nslookup busybox-1
|
|
||||||
kubectl get pods -n kube-system
|
|
||||||
kubectl get service -n kube-system
|
|
||||||
kubectl exec -it busybox22 -- cat /etc/resolv.conf
|
|
||||||
kubectl -n kube-system describe pods coredns-6955765f44-4mg22
|
|
||||||
for p in $(kubectl get pods -n kube-system -l k8s-app=kube-dns -o name); do kubectl logs -n kube-system $p; done
|
|
||||||
kubectl get svc -n kube-system
|
|
||||||
kubectl get ep kube-dns -n kube-system
|
|
||||||
kubectl get pods --show-labels --all-namespaces
|
|
||||||
kubectl run busy22 --image busybox --restart Never; kubectl expose pod busy22 --name mysvc --port 80 --type ClusterIP; kubectl exec busy22 -- sh -c "mkdir -p /var/exam && nslookup busy22 > /var/exam/dnsnames.txt"
|
|
||||||
kubectl exec busy22 -- sh -c "mkdir -p /var/exam && nslookup busy22 > /var/exam/dnsnames.txt"
|
|
||||||
kubectl -it exec busy22 -- sh -c "mkdir -p /var/exam && nslookup busy22 > /var/exam/dnsnames.txt"
|
|
||||||
kubectl get svc
|
|
||||||
kubectl get pods
|
|
||||||
kubectl -it exec busybox22 -- sh -c "mkdir -p /var/exam && nslookup busy22 > /var/exam/dnsnames.txt"
|
|
||||||
kubectl -it exec busybox22 -- sh -c "mkdir -p /var/exam && nslookup busybox22 > /var/exam/dnsnames.txt"
|
|
||||||
kubectl -it exec busybox22 -- nslookup busybox22
|
|
||||||
kubectl get
|
|
||||||
kubectl -it exec busybox22 -- nslookup myapp-pod
|
|
||||||
kubectl get sv
|
|
||||||
kubectl -it exec busybox22 -- nslookup mysvc
|
|
||||||
iptables -L
|
|
||||||
sudo iptables -L
|
|
||||||
ssh root@worker1
|
|
||||||
kubectl get pods -n kube-system
|
|
||||||
ssh root@worker3
|
|
||||||
kubectl get pods -o wide
|
|
||||||
./counter.sh 10
|
|
||||||
git clone https://github.com/kubernetes-incubator/metrics-server.git
|
|
||||||
kubectl create -f metrics-server/deploy/1.8+/
|
|
||||||
kubectl get all -n kube-system
|
|
||||||
kubectl top pods
|
|
||||||
kubectl top pods --all-namespaces
|
|
||||||
kubectl -n kube-system edit deployment metrics-server
|
|
||||||
kubectl -n kube-system logs metric-server
|
|
||||||
kubectl -n kube-system logs metrics-server-d98f494df-jhdht
|
|
||||||
kubectl top pods --all-namespaces
|
|
||||||
ssh worker3
|
|
||||||
kubectl get pods --all-namespaces
|
|
||||||
kubectl top pods --all-namespaces
|
|
||||||
kubectl delete pod/busy22
|
|
||||||
kubectl top pods --all-namespaces
|
|
||||||
cd
|
|
||||||
vim .kube/config
|
|
||||||
sudo vim /etc/kubernetes/admin.conf
|
|
||||||
kubectl get pods -n kube-system
|
|
||||||
su -i
|
|
||||||
su -
|
|
||||||
kubectl get pods -n kube-system
|
|
||||||
kubectl -n kube-system delete pod metrics-server-d98f494df-jhdht
|
|
||||||
kubectl top pods --all-namespaces
|
|
||||||
kubectl create deployment mydaemonset --image nginx -o yaml --dry-run > ds.yaml
|
|
||||||
vim ds.yaml
|
|
||||||
kubectl api-resources | grep -i daemon
|
|
||||||
vim ds.yaml
|
|
||||||
kubectl create -f ds.yaml
|
|
||||||
cd cka
|
|
||||||
ls
|
|
||||||
vim daemonset-fluentd.yaml
|
|
||||||
kubectl explain DaemonSet
|
|
||||||
kubectl explain DaemonSet | less
|
|
||||||
vim daemonset-fluentd.yaml
|
|
||||||
kubectl create -f daemonset-fluentd.yaml
|
|
||||||
kubectl get daemonset.apps/fluentd-elasticsearch
|
|
||||||
kubectl get daemonset
|
|
||||||
vim daemonset-fluentd.yaml
|
|
||||||
kubectl -n kube-system get daemonset fluentd-elasticsearch -o yaml | less
|
|
||||||
history | grep edit
|
|
||||||
kubectl -n kube-system edit deployment metrics-server
|
|
||||||
history | grep delete
|
|
||||||
kubectl -n kube-system delete pod metrics-server-5d7898476-nhlq7
|
|
||||||
kubectl top pods --all-namespaces
|
|
||||||
kubectl -n kube-system edit deployment metrics-server
|
|
||||||
kubectl top pods --all-namespaces
|
|
||||||
kubectl top pods
|
|
||||||
kubectl -n kube-system edit deployment metrics-server
|
|
||||||
kubectl get pods -n kube-system
|
|
||||||
kubectl -n kube-system exec -it metrics-server-5d7898476-465j7 -- /bin/sh
|
|
||||||
kubectl -n kube-system exec -it metrics-server-5d7898476-465j7 -- /bin/bash
|
|
||||||
kubectl -n kube-system exec -it metrics-server-5d7898476-465j7 -- bash
|
|
||||||
history
|
|
||||||
exit
|
|
||||||
@ -1,78 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# verified on Fedora 31, 33 and Ubuntu LTS 20.04
|
|
||||||
|
|
||||||
echo this script works on Fedora 31, 33 and Ubuntu 20.04
|
|
||||||
echo it does NOT currently work on Fedora 32
|
|
||||||
echo it requires the machine where you run it to have 6GB of RAM or more
|
|
||||||
echo press Enter to continue
|
|
||||||
read
|
|
||||||
|
|
||||||
##########
|
|
||||||
echo ########################################
|
|
||||||
echo WARNING
|
|
||||||
echo ########################################
|
|
||||||
echo Nov 2020 - currently this script is NOT supported on Mac OS Big Sur
|
|
||||||
echo I will communicate here one Apple/VMware have provided updates that make it work again
|
|
||||||
echo
|
|
||||||
echo Check the Setup Guide provided in this repository for alternative installations
|
|
||||||
echo
|
|
||||||
echo press Enter to continue
|
|
||||||
read
|
|
||||||
|
|
||||||
# setting MYOS variable
|
|
||||||
MYOS=$(hostnamectl | awk '/Operating/ { print $3 }')
|
|
||||||
OSVERSION=$(hostnamectl | awk '/Operating/ { print $4 }')
|
|
||||||
|
|
||||||
egrep '^flags.*(vmx|svm)' /proc/cpuinfo || (echo enable CPU virtualization support and try again && exit 9)
|
|
||||||
|
|
||||||
# debug MYOS variable
|
|
||||||
echo MYOS is set to $MYOS
|
|
||||||
|
|
||||||
#### Fedora config
|
|
||||||
if [ $MYOS = "Fedora" ]
|
|
||||||
then
|
|
||||||
if [ $OSVERSION = 32 ]
|
|
||||||
then
|
|
||||||
echo Fedora 32 is not currently supported
|
|
||||||
exit 9
|
|
||||||
fi
|
|
||||||
|
|
||||||
sudo dnf clean all
|
|
||||||
sudo dnf -y upgrade
|
|
||||||
|
|
||||||
# install KVM software
|
|
||||||
sudo dnf install @virtualization -y
|
|
||||||
sudo systemctl enable --now libvirtd
|
|
||||||
sudo usermod -aG libvirt `id -un`
|
|
||||||
fi
|
|
||||||
|
|
||||||
### Ubuntu config
|
|
||||||
if [ $MYOS = "Ubuntu" ]
|
|
||||||
then
|
|
||||||
sudo apt-get update -y
|
|
||||||
sudo apt-get install -y apt-transport-https curl
|
|
||||||
sudo apt-get upgrade -y
|
|
||||||
sudo apt-get install -y qemu-kvm libvirt-daemon-system libvirt-clients bridge-utils
|
|
||||||
|
|
||||||
sudo adduser `id -un` libvirt
|
|
||||||
sudo adduser `id -un` kvm
|
|
||||||
fi
|
|
||||||
|
|
||||||
# install kubectl
|
|
||||||
curl -LO https://storage.googleapis.com/kubernetes-release/release/`curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt`/bin/linux/amd64/kubectl
|
|
||||||
chmod +x ./kubectl
|
|
||||||
sudo mv ./kubectl /usr/local/bin/kubectl
|
|
||||||
|
|
||||||
# install minikube
|
|
||||||
echo downloading minikube, check version
|
|
||||||
curl -Lo minikube https://storage.googleapis.com/minikube/releases/latest/minikube-linux-amd64
|
|
||||||
|
|
||||||
sudo chmod +x minikube
|
|
||||||
sudo mv minikube /usr/local/bin
|
|
||||||
|
|
||||||
# start minikube
|
|
||||||
minikube start --memory 4096 --vm-driver=kvm2
|
|
||||||
|
|
||||||
echo if this script ends with an error, restart the virtual machine
|
|
||||||
echo and manually run minikube start --memory 4096 --vm-driver=kvm2
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
kind: Role
|
|
||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
||||||
metadata:
|
|
||||||
namespace: production
|
|
||||||
name: dev-prod
|
|
||||||
rules:
|
|
||||||
- apiGroups: ["", "extensions", "apps"]
|
|
||||||
resources: ["deployments", "replicasets", "pods"]
|
|
||||||
verbs: ["list", "get", "watch"]
|
|
||||||
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
kind: RoleBinding
|
|
||||||
apiVersion: rbac.authorization.k8s.io/v1beta1
|
|
||||||
metadata:
|
|
||||||
name: production-role-binding
|
|
||||||
namespace: production
|
|
||||||
subjects:
|
|
||||||
- kind: User
|
|
||||||
name: anna
|
|
||||||
apiGroup: ""
|
|
||||||
roleRef:
|
|
||||||
kind: Role
|
|
||||||
name: dev-prod
|
|
||||||
apiGroup: ""
|
|
||||||
@ -2,6 +2,23 @@
|
|||||||
# kubeadm installation instructions as on
|
# kubeadm installation instructions as on
|
||||||
# https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
|
# https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/install-kubeadm/
|
||||||
|
|
||||||
|
# this script supports centos 7 and Ubuntu 20.04 only
|
||||||
|
# run this script with sudo
|
||||||
|
|
||||||
|
if ! [ $USER = root ]
|
||||||
|
then
|
||||||
|
echo run this script with sudo
|
||||||
|
exit 3
|
||||||
|
fi
|
||||||
|
|
||||||
|
# setting MYOS variable
|
||||||
|
MYOS=$(hostnamectl | awk '/Operating/ { print $3 }')
|
||||||
|
OSVERSION=$(hostnamectl | awk '/Operating/ { print $4 }')
|
||||||
|
|
||||||
|
##### CentOS 7 config
|
||||||
|
if [ $MYOS = "centos" ]
|
||||||
|
then
|
||||||
|
echo RUNNING CENTOS CONFIG
|
||||||
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
|
cat <<EOF > /etc/yum.repos.d/kubernetes.repo
|
||||||
[kubernetes]
|
[kubernetes]
|
||||||
name=Kubernetes
|
name=Kubernetes
|
||||||
@ -23,6 +40,28 @@ swapoff /dev/mapper/centos-swap
|
|||||||
yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
|
yum install -y kubelet kubeadm kubectl --disableexcludes=kubernetes
|
||||||
|
|
||||||
systemctl enable --now kubelet
|
systemctl enable --now kubelet
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $MYOS = "Ubuntu" ]
|
||||||
|
then
|
||||||
|
echo RUNNING UBUNTU CONFIG
|
||||||
|
cat <<EOF | sudo tee /etc/modules-load.d/k8s.conf
|
||||||
|
br_netfilter
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sudo apt-get update && sudo apt-get install -y apt-transport-https curl
|
||||||
|
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | sudo apt-key add -
|
||||||
|
cat <<EOF | sudo tee /etc/apt/sources.list.d/kubernetes.list
|
||||||
|
deb https://apt.kubernetes.io/ kubernetes-xenial main
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sudo apt-get update
|
||||||
|
sudo apt-get install -y kubelet kubeadm kubectl
|
||||||
|
sudo apt-mark hold kubelet kubeadm kubectl
|
||||||
|
swapoff /swapfile
|
||||||
|
|
||||||
|
sed -i 's/swapfile/#swapfile/' /etc/fstab
|
||||||
|
fi
|
||||||
|
|
||||||
# Set iptables bridging
|
# Set iptables bridging
|
||||||
cat <<EOF > /etc/sysctl.d/k8s.conf
|
cat <<EOF > /etc/sysctl.d/k8s.conf
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user