当前位置:网站首页>Kubernetes cluster command line tool kubectl
Kubernetes cluster command line tool kubectl
2022-06-28 07:37:00 【Courageous steak】
List of articles
1 kubectl summary
kubectl yes Kubernetes Command line tools for clustering , adopt kubectl Be able to manage the cluster itself , And can install and deploy container applications on the cluster .
2 kubernetes command
2.1 kubectl The syntax of the command
kubectl [common] [TYPE] [NAME] [flags]
(1)comand: Specifies the action to be performed on the resource , for example create、get、describe and delete
(2)TYPE: Specify the type of resource , Resource types are case sensitive , Developers can use the singular number 、 Plural and abbreviated forms , for example :
kubectl get pod pod1
kubectl get pods pod1
kubectl get po pod1
(3)NAME: Specify the name of the resource , Names are also case sensitive . If you omit the name , All resources will be displayed .
kubectl get pods
(4)flags: Specify optional parameters . for example : You can use -s perhaps -server Parameter assignment Kubernetes API Server The address and port of .
kubectl get node
kubectl get nodes
kubectl get nodes master

Help order kubectl --help
See a specific operation
kubectl get --help
2.2 Common commands
nginx For example
establish nginx pod
kubectl create deployment nginx --image=nginx
External exposure port
kubectl expose deployment nginx --port=80 --type=NodePort
kubectl get pod, svc

View current health status
kubectl get cs
3 Use command
3.1 check
check pods
# View all pods Specify the namespace
kubectl get pods --all-namespaces
check service
# Check all service
kubectl get service
3.2 Deployment operation
see
kubectl get deployment
Delete
kubectl get deployment
kubectl delete deployment flask-demo
perhaps
kubectl delete-f app.yaml
4 Project deployment
vim app.yaml
# 1 Deployment information
apiVersion: apps/v1
kind: Deployment # use deployment Deploy
metadata:
name: flask-demo
namespace: default # Default namespace
labels:
app: flask-demo
spec:
replicas: 2 # Copy settings 1 individual
selector:
matchLabels:
app: flask-demo
template:
metadata:
labels:
app: flask-demo
spec:
containers: # Container related configuration
- name: flask-demo-app
image: vitcloud/flask_demo:latest # Mirror address
ports: # Container exposure port
- containerPort: 80
resources: # Resources to be used by the container
requests:
cpu: "1000m"
memory: "1Gi"
limits:
cpu: "2000m"
memory: "2Gi"
# service Information --- Associated with deployment
apiVersion: v1
kind: Service
metadata:
name: flask-demo-service
spec:
selector: # ==== Corresponding
app: flask-demo # Point to pod
type: NodePort # Open service through port
ports:
- name: web
port: 80
protocol: TCP
# targetPort: 80 # Container port
# nodePort: 30001 # External exposure port
Specified file
kubectl apply -f app.yaml
# see
kubectl get pods --all-namespaces -o wide
# View progress
watch kubectl get pods --all-namespaces -o wide
# View resource details
kubectl describe pods flask-demo-77f769cb94-7pw4q
边栏推荐
- Mysql57 zip file installation
- flutter 实现摇一摇功能
- 7-1 understand everything
- 8 figures | analyze Eureka's first synchronization registry
- goland IDE和delve调试位于kubernetes集群中的go程序
- ice, protobuf ,thrift -- 笔记
- Section 5: zynq interrupt
- Alibaba cloud server creates snapshots and rolls back disks
- 阿里云服务器创建快照、回滚磁盘
- R 语言绘制 动画气泡图
猜你喜欢

Practice of traffic recording and playback in vivo

Mysql57 zip file installation

Top 25 most popular articles on vivo Internet technology in 2021

kubernetes集群命令行工具kubectl

vite2.9 中指定路径别名

Hash slot of rediscluster cluster cluster implementation principle

ES6 use of return in arrow function

Section 8: DMA of zynq

kubelet垃圾(退出的容器和未使用的镜像)回收源码分析

Spark 离线开发框架设计与实现
随机推荐
Self discipline challenge 30 days
以动态规划的方式求解最长回文子串
R 语言 Kolmogorov-Smirnov 检验 2 个样本是否遵循相同的分布。
ES6 use of return in arrow function
2021 programming language ranking summary
kubelet垃圾(退出的容器和未使用的镜像)回收源码分析
看似简单的光耦电路,实际使用中应该注意些什么?
HJ明明的随机数
kubernetes删除pod的流程的源码简析
[thanos source code analysis series]thanos query component source code analysis
Kubernetes deploys a secret pit where thanos ruler sends repeated alarms
es数据导出csv文件
Mysql57 zip file installation
Rediscluster cluster mode capacity expansion node
Uninstall and reinstall the latest version of MySQL database. The test is valid
一个小工具可以更快的写爬虫
Practice and exploration of vivo live broadcast application technology
Section 9: dual core startup of zynq
打新债注册开户靠谱吗?安全吗?
Tencent continued to lay off staff in the second half of the year, and all business groups reduced by at least 10%. What do you think of this? Followers