Untitled

From Commodious Pig, 7 Years ago, written in Plain Text, viewed 3 times.
URL https://paste.blessuren.de/view/2e58b0b1 Embed
Download Paste or View Raw
  1. # pod network add advert address
  2. kubeadm init --pod-network-cidr=192.168.0.0/16 --apiserver-advertise-address=10.7.96.3
  3. export KUBECONFIG=/etc/kubernetes/admin.conf
  4.  
  5. # calico
  6. kubectl apply -f https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/rbac-kdd.yaml
  7. kubectl apply -f https://docs.projectcalico.org/v3.3/getting-started/kubernetes/installation/hosted/kubernetes-datastore/calico-networking/1.7/calico.yaml
  8.  
  9. #By default, your cluster will not schedule pods on the master for security reasons. If you want to be able to schedule pods on the master, e.g. for a single-machine Kubernetes cluster for development, run:
  10. kubectl taint nodes --all node-role.kubernetes.io/master-
  11.  
  12. kubectl run demo-1 --image=gcr.io/google-samples/kubernetes-bootcamp:v1 --port=8080
  13. kubectl expose deployment demo-1 --type=NodePort --name=demo-service
  14.  
  15. kubectl create -f deployment-echoserver.yaml
  16. kubectl delete -f deployment-echoserver.yaml
  17.  
  18.  
  19. ####
  20.  
  21. apiVersion: v1
  22. kind: Service
  23. metadata:
  24.   name: mytest
  25. spec:
  26.   selector:
  27.     app: echoserver
  28.   ports:
  29.   - protocol: "TCP"
  30.     port: 8080
  31.     nodePort: 30001
  32.   type: NodePort
  33. ---
  34. apiVersion: apps/v1
  35. kind: Deployment
  36. metadata:
  37.   name: my-test
  38. spec:
  39.   selector:
  40.     matchLabels:
  41.       app: echoserver
  42.   replicas: 15
  43.   template:
  44.     metadata:
  45.       labels:
  46.         app: echoserver
  47.     spec:
  48.       containers:
  49.       - name: echopod
  50.         image: "gcr.io/google_containers/echoserver:1.10"
  51.         lifecycle:
  52.           preStop:
  53.             exec:
  54.               command: ["echo","dead"]
  55.  
  56.  
  57. ####
  58.  
  59. kind: Deployment
  60. metadata:
  61.   name: hello
  62. spec:
  63.   selector:
  64.     matchLabels:
  65.       app: hello
  66.       tier: backend
  67.       track: stable
  68.   replicas: 7
  69.   template:
  70.     metadata:
  71.       labels:
  72.         app: hello
  73.         tier: backend
  74.         track: stable
  75.     spec:
  76.       containers:
  77.         - name: hello
  78.           image: "gcr.io/google-samples/hello-go-gke:1.0"
  79.           ports:
  80.             - name: http
  81.               containerPort: 80
  82. ---
  83. kind: Service
  84. apiVersion: v1
  85. metadata:
  86.   name: hello
  87. spec:
  88.   selector:
  89.     app: hello
  90.     tier: backend
  91.   ports:
  92.   - protocol: TCP
  93.     port: 80
  94.     targetPort: http
  95. ---
  96. apiVersion: v1
  97. kind: Service
  98. metadata:
  99.   name: frontend
  100. spec:
  101.   selector:
  102.     app: hello
  103.     tier: frontend
  104.   ports:
  105.   - protocol: "TCP"
  106.     port: 80
  107.     nodePort: 30000
  108.   type: NodePort
  109. ---
  110. apiVersion: apps/v1
  111. kind: Deployment
  112. metadata:
  113.   name: frontend
  114. spec:
  115.   selector:
  116.     matchLabels:
  117.       app: hello
  118.       tier: frontend
  119.       track: stable
  120.   replicas: 1
  121.   template:
  122.     metadata:
  123.       labels:
  124.         app: hello
  125.         tier: frontend
  126.         track: stable
  127.     spec:
  128.       containers:
  129.       - name: nginx
  130.         image: "gcr.io/google-samples/hello-frontend:1.0"
  131.         lifecycle:
  132.           preStop:
  133.             exec:
  134.               command: ["/usr/sbin/nginx","-s","quit"]
  135.  
  136. #### INSTALL SCRIPT
  137.  
  138. #!/bin/sh
  139.  
  140. apt-get update
  141. apt-get install -y apt-transport-https ca-certificates curl software-properties-common
  142.  
  143. curl -fsSL https://get.docker.com -o get-docker.sh
  144. sh get-docker.sh
  145.  
  146. apt-get update && apt-get install -y apt-transport-https curl
  147. curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
  148.  
  149. cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
  150.  
  151. deb https://apt.kubernetes.io/ kubernetes-xenial main
  152.  
  153. EOF
  154.  
  155. apt-get update
  156. apt-get install -y kubelet kubeadm kubectl
  157. apt-mark hold kubelet kubeadm kubectl
  158.  
  159. # tools
  160. apt-get install -y vim jq procps curl zsh git
  161.  
  162. swapoff -a
  163.  
  164. echo "set mouse-=a" > ~/.vimrc
  165.  
  166. sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
  167.  
  168. kubeadm config images pull
  169.  
  170.  

Reply to "Untitled"

Here you can reply to the paste above