forked from anujdevopslearn/Docker
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Kubernetes
42 lines (28 loc) · 1.46 KB
/
Kubernetes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
apt-get update && apt-get upgrade
apt-get update && apt-get install -y curl apt-transport-https docker.io
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" >/etc/apt/sources.list.d/kubernetes.list
apt-get update
apt-get install -y kubelet kubeadm kubectl
kubeadm init
mkdir -p $HOME/.kube
sudo cp -i /etc/kubernetes/admin.conf $HOME/.kube/config
sudo chown $(id -u):$(id -g) $HOME/.kube/config
export kubever=$(kubectl version | base64 | tr -d '\n')
kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$kubever"
kubectl get node
kubectl get pods --all-namespaces
kubectl taint nodes --all node-role.kubernetes.io/master-
kubectl create namespace application
kubectl get pods --all-namespaces
kubectl run kubernetes-bootcamp --image=docker.io/jocatalin/kubernetes-bootcamp:v1 --port=8080
kubectl get services
kubectl expose deployment/kubernetes-bootcamp --port=8080 --target-port=8080 --type=NodePort
kubectl expose deployment/kubernetes-bootcamp --port=8080 --target-port=8080 --type=LoadBalancer
kubectl describe services kubernetes-bootcamp
kubectl exec -ti $POD_NAME curl localhost:8080
kubectl scale deployments/kubernetes-bootcamp --replicas=2
kubectl get pods -o wide
kubectl set image deployments/kubernetes-bootcamp kubernetes-bootcamp=jocatalin/kubernetes-bootcamp:v2
kubectl rollout undo deployments/kubernetes-bootcamp
kubectl rollout status deployments/kubernetes-bootcamp