Skip to content

Instantly share code, notes, and snippets.

@alexandre2602
Forked from badtuxx/AULA-K8s-01
Created September 23, 2020 17:51
Show Gist options
  • Save alexandre2602/ae12c783171d0efba3a3fd516dbe8df6 to your computer and use it in GitHub Desktop.
Save alexandre2602/ae12c783171d0efba3a3fd516dbe8df6 to your computer and use it in GitHub Desktop.

Revisions

  1. @badtuxx badtuxx created this gist May 16, 2020.
    147 changes: 147 additions & 0 deletions AULA-K8s-01
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,147 @@
    1 hostname elliot-01
    2 echo elliot-01 > /etc/hostname
    3 bash
    4 vim /etc/modules-load.d/k8s.conf
    5 curl -fsSL https://get.docker.com | bash
    6 docker version
    7 docker ps
    8 apt-get update && apt-get install -y apt-transport-https
    9 curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
    10 echo "deb http://apt.kubernetes.io/ kubernetes-xenial main" > /etc/apt/sources.list.d/kubernetes.list
    11 cat /etc/apt/sources.list.d/kubernetes.list
    12 cat /etc/apt/sources.list.d/docker.list
    13 history
    14 apt-get update
    15 apt-get install -y kubelet kubectl kubeadm
    16 kubectl
    17 docker info | grep -i cgroup
    18 cgroupfs
    19 swaps
    20 cat /proc/swaps
    21 swapoff -a
    22 kubeadm config images pull
    23 kubeadm init
    24 ls -lha .kube/
    25 kubectl apply -f "https://cloud.weave.works/k8s/net?k8s-version=$(kubectl version | base64 | tr -d '\n')"
    26 kubectl get all --all-namespaces
    27 kubectl get pods --all-namespaces
    28 kubectl get nodes
    29 kubectl describe node elliot-01
    30 kubectl describe node elliot-02
    31* kubectl get node
    32 kubectl describe node elliot-03
    33 kubeadm token create --print-join-command
    34 source <(kubectl completion bash)
    35 kubectl completion bash
    36 source <(kubectl completion bash)
    37 kubectl completion bash > /etc/bash_completion.d/kubectl
    38 cat /etc/bash_completion.d/kubectl
    39 kubectl get namespaces
    40 kubectl get pods -n kube-system
    41 kubectl get pods -n kube-system -o wide
    42 kubectl run --image=nginx nginx
    43 kubectl get pods
    44 kubectl describe pods nginx
    45 kubectl get pdos
    46 kubectl get pods
    47 kubectl get pods -o yaml
    48 kubectl get pods nginx -o yaml
    49 kubectl get pods nginx -o yaml > meu_primeiro_pod.yaml
    50 cat meu_primeiro_pod.yaml
    51 vim meu_primeiro_pod.yaml
    52 kubectl get pods
    53 kubectl delete pods nginx
    54 kubectl get pods
    55 kubectl create -f meu_primeiro_pod.yaml
    56 head meu_primeiro_pod.yaml
    57 kubectl get pods
    58 # kubectl run --image=nginx nginx
    59 # kubectl get pods nginx -o yaml > meu_primeiro_pod.yaml
    60 # vim meu_primeiro_pod.yaml
    61 #kubectl create -f meu_primeiro_pod.yaml
    62 # kubectl run --image=nginx nginx
    63 # kubectl get pods nginx -o yaml > meu_primeiro_pod.yaml
    64 # vim meu_primeiro_pod.yaml
    65 # kubectl create -f meu_primeiro_pod.yaml
    66 kubectl get pods
    67 kubectl run --image=nginx giropops_nginx --dry-run=client -o yaml > giropops_pod.yaml
    68 cat giropops_pod.yaml
    69 vim giropops_pod.yaml
    70 kubectl create -f giropops_pod.yaml
    71 vim giropops_pod.yaml
    72 kubectl create -f giropops_pod.yaml
    73 kubectl get pods
    74 kubectl create deployment giropops --image=nginx --dry-run=client -o yaml > giropops_deployment.yaml
    75 vim giropops_deployment.yaml
    76 kubectl create -f giropops_deployment.yaml
    77 kubectl get deployments.apps
    78 kubectl get pods
    79 kubectl delete -f giropops_deployment.yaml
    80 kubectl get pods
    81 kubectl get deployments.apps
    82 kubectl get pods
    83 kubectl delete pods giropops-nginx
    84 kubectl delete pods nginx
    85 kubectl get pods
    86 kubectl create -f giropops_deployment.yaml -n opa
    87 kubectl create namespace opa
    88 kubectl get namespaces
    89 kubectl create -f giropops_deployment.yaml -n opa
    90 kubectl get deployment
    91 kubectl get deployment -n opa
    92 kubectl get pods
    93 kubectl get pods -n opa
    94 kubectl explain deployment
    95 kubectl explain pod
    96 kubectl explain pod --recursive
    97 kubectl explain deployment.spec.template.spec
    98 kubectl get deployment -n opa
    99 kubectl expose deployment -n opa giropops
    100 kubectl delete -f giropops_deployment.yaml
    101 l
    102 kubectl get deployment -n opa
    103 kubectl delete deployments.apps -n opa giropops
    104 kubectl get pods -n opa
    105 kubectl get pods
    106 kubectl run --image=nginx nginx
    107 kubectl get pods
    108 # kubectl run --image=nginx nginx
    109 kubectl get pods
    110 kubectl expose pod nginx
    111 kubectl expose pod nginx --port 80
    112 kubectl get pods
    113 kubectl get services
    114 curl 10.109.95.3
    115 kubectl delete service nginx
    116 kubectl expose pod nginx --port 80 --type NodePort
    117 kubectl get services
    118 curl 10.96.84.253
    119 kubectl get services
    120 kubectl get pods
    121 kubectl logs -f nginx
    122 kubectl get pods
    123 kubectl exec -ti nginx sh
    124 L
    125 kubectl get pods
    126 kubectl logs -f nginx
    127 kubectl get pods
    128 kubectl get deployments.apps
    129 kubectl get service
    130 kubectl get namespaces
    131 kubectl get nodes
    132 history
    133 kubectl get pods
    134 kubectl get po
    135 kubectl get deployments.apps
    136 kubectl get deploy
    137 kubectl get namespaces
    138 kubectl get ns
    139 kubectl get services
    140 kubectl get svc
    141 kubectl get pods,deploy,services,namespaces,nodes
    142 kubectl get all
    143 kubectl delete pods nginx
    144 kubectl get pods,deploy,services,namespaces,nodes
    145 kubectl delete service nginx
    146 kubectl get pods,deploy,services,namespaces,nodes
    147 kubectl delete ns opa