Giter Club home page Giter Club logo

cka's Introduction

CKA

Information

15-20 Tasks. 17 for me. 2 hours. ~ 3 clusters. Context change commands are given. ControlPlane + 2 Nodes.

Pre-setup

Add to .bashrc

alias k=kubectl # will already be pre-configured

export do="--dry-run=client -o yaml" # k create deploy nginx --image=nginx $do //useful

export now="--force --grace-period 0" # k delete pod x $now //not very

Get infomation

Get nodes CIDR

k get nodes -o jsonpath={".items[*].spec.podCIDR"}

k get nodes -o json | jq ".items[].spec.podCIDR"

Get nodes osImage

k get nodes -o jsonpath={".items[*].status.nodeInfo.osImage"}

k get nodes -o json | jq ".items[].status.nodeInfo.osImage"

Create resources

Create pod

kubectl run nginx --image=nginx

Create pod template

kubectl run nginx --image=nginx --labels=env=prod --dry-run=client -o yaml > nginx_pod.yaml

Create deployment

kubectl create deploy --image=nginx nginx

Create deployment template

kubectl create deploy --image=nginx nginx --dry-run=client -o yaml > nginx-deployment.yaml

Create daemonset

To create a daemonset, use Create deployment template file and change the kind and remove replicas & strategy.

Create PV

kubectl apply -f https://k8s.io/examples/pods/storage/pv-volume.yaml

Create service

kubectl expose pod valid-pod --port=444 --name=frontend

Create configmap app-config with env=dev:

kubectl create configmap app-config --from-literal=env=dev

Create secret app-secret with pass=123:

kubectl create secret generic app-secret --from-literal=pass=123

Network policy

Scale

Cluster maintenance

Cluster upgrade(kubeadm)

  1. Controlplane apt update apt upgrade kubeadm=1.26.0-00 kubeadm upgrade plan kubeadm upgrade apply v1.26.0

  2. Worker Nodes apt update apt upgrade kubeadm=1.26.0-00 kubeadm upgrade node

  3. Kubelet/Kubectl(all nodes) apt-get install -y kubelet=1.26.0-00 kubectl=1.26.0-00 systemctl daemon-reload systemctl restart kubelet

ETCD

  1. snapshot
  2. restore

cka's People

Contributors

alexkurd avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.