[root@yygh-de rollback]# kubectl explain rs.spec
KIND: ReplicaSet
VERSION: apps/v1
RESOURCE: spec
DESCRIPTION:
Spec defines the specification of the desired behavior of the ReplicaSet.
More info:
https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#spec-and-status
ReplicaSetSpec is the specification of a ReplicaSet.
FIELDS:
minReadySeconds
Minimum number of seconds forwhich a newly created pod should be ready
without any of its container crashing, forit to be considered available.
Defaults to 0(pod will be considered available as soon as it is ready)
# Kubernetes在等待设置的时间后才进行升级
# 如果没有设置该值,Kubernetes会假设该容器启动起来后就提供服务了
# 如果没有设置该值,在某些极端情况下可能会造成服务服务正常运行
replicas
Replicas is the number of desired replicas. This is a pointer to
distinguish between explicit zero and unspecified. Defaults to 1. More
info:
# 保证的副本数 https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller/#what-is-a-replicationcontroller
selector -required-
Selector is a label query over pods that should match the replica count.
Label keys and values that must match inorder to be controlled by this
replica set. It must match the pod template's labels. More info:
https://kubernetes.io/docs/concepts/overview/working-with-objects/labels/#label-selectors
template
Template is the object that describes the pod that will be created if
insufficient replicas are detected. More info:
https://kubernetes.io/docs/concepts/workloads/controllers/replicationcontroller#pod-template
5、Deployment
[root@yygh-de rollback]# kubectl explain deploy.spec
KIND: Deployment
VERSION: apps/v1
RESOURCE: spec
DESCRIPTION:
Specification of the desired behavior of the Deployment.
DeploymentSpec is the specification of the desired behavior of the
Deployment.
FIELDS:
minReadySeconds
Minimum number of seconds forwhich a newly created pod should be ready
without any of its container crashing, forit to be considered available.
Defaults to 0(pod will be considered available as soon as it is ready)
paused
Indicates that the deployment is paused.
# 用于暂停记录部署版本信息
progressDeadlineSeconds
The maximum time inseconds fora deployment to makeprogress before it is
considered to be failed. The deployment controller will continue to process
failed deployments and a condition with a ProgressDeadlineExceeded reason
will be surfaced inthe deployment status. Note that progress will not be
estimated during the time a deployment is paused. Defaults to 600s.
# 等待多少秒才能确定Deployment进程是卡住的。如果卡住,这次部署失败,并汇报自己状态,我们可以用kubectl describe查看原因,进行手动修复等
replicas
Number of desired pods. This is a pointer to distinguish between explicit
zero and not specified. Defaults to 1.
# 副本
revisionHistoryLimit
The number of old ReplicaSets to retain to allow rollback. This is a
pointer to distinguish between explicit zero and not specified. Defaults to
10.
# 历史总记录数
selector -required-
Label selector forpods. Existing ReplicaSets whose pods are selected by
this will be the ones affected by this deployment. It must match the pod
template's labels.
strategy
The deployment strategy to use to replace existing pods with new ones.
# 滚动更新策略
template -required-
Template describes the pods that will be created.
6、滚动更新策略
[root@yygh-de rollback]# kubectl explain deploy.spec.strategy
KIND: Deployment
VERSION: apps/v1
RESOURCE: strategy
DESCRIPTION:
The deployment strategy to use to replace existing pods with new ones.
DeploymentStrategy describes how to replace existing pods with new ones.
FIELDS:
rollingUpdate
Rolling update config params. Present only ifDeploymentStrategyType =
RollingUpdate.
# Recreate 全部重新创建
# RollingUpdate 拉起一个停一个
type
Type of deployment. Can be "Recreate"or "RollingUpdate". Default is
RollingUpdate.
7、rollingUpdate的两种方式
[root@yygh-de rollback]# kubectl explain deploy.spec.strategy.rollingUpdate
KIND: Deployment
VERSION: apps/v1
RESOURCE: rollingUpdate
DESCRIPTION:
Rolling update config params. Present only ifDeploymentStrategyType =
RollingUpdate.
Spec to control the desired behavior of rolling update.
FIELDS:
maxSurge
The maximum number of pods that can be scheduled above the desired number
of pods. Value can be an absolute number (ex: 5) or a percentage of desired
pods (ex: 10%). This can not be 0ifMaxUnavailable is 0. Absolute number
is calculated from percentage by rounding up. Defaults to 25%. Example:
when this is setto 30%, the new ReplicaSet can be scaled up immediately
when the rolling update starts, such that the total number of old and new
pods donot exceed 130% of desired pods. Once old pods have been killed,
new ReplicaSet can be scaled up further, ensuring that total number of pods
running at any time during the update is at most 130% of desired pods.
maxUnavailable
The maximum number of pods that can be unavailable during the update. Value
can be an absolute number (ex: 5) or a percentage of desired pods (ex:
10%). Absolute number is calculated from percentage by rounding down. This
can not be 0ifMaxSurge is 0. Defaults to 25%. Example: when this is set
to 30%, the old ReplicaSet can be scaled down to 70% of desired pods
immediately when the rolling update starts. Once new pods are ready, old
ReplicaSet can be scaled down further, followed by scaling up the new
ReplicaSet, ensuring that the total number of pods available at all times
during the update is at least 70% of desired pods.
8、rollingUpdate的两种方式yaml演示
8.1编写yaml
[root@yygh-de rollback]# vim test.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: frontend-test
labels:
app: guestbook
tier: frontend
spec:
# modify replicas according to your case
strategy:
rollingUpdate:
maxSurge: 1
maxUnavailable: 2
replicas: 6
selector:
matchLabels:
tier: frontend-test
template:
metadata:
labels:
tier: frontend-test
spec:
containers:
-name: php-redis
image: tomcat:6
8.2查看服务
[root@yygh-de rollback]# kubectl apply -f test.yaml
deployment.apps/frontend-test created
[root@yygh-de rollback]# kubectl set image deployment.apps/frontend-test php-redis=tomcat:777
[root@yygh-de rollback]# kubectl get pod
NAME READY STATUS RESTARTS AGE
frontend-test-6f8656f964-8lt6p 0/1 ImagePullBackOff 0 25s
frontend-test-6f8656f964-j2d7s 0/1 ImagePullBackOff 0 25s
frontend-test-6f8656f964-jcx6p 0/1 ImagePullBackOff 0 25s
frontend-test-c986f4d7c-5qjqt 1/1 Running 0 48s
frontend-test-c986f4d7c-7wgjz 1/1 Running 0 48s
frontend-test-c986f4d7c-lbl6l 1/1 Running 0 48s
frontend-test-c986f4d7c-nxr7r 1/1 Running 0 48s
[root@yygh-de rollback]# kubectl get deployment
NAME READY UP-TO-DATE AVAILABLE AGE
frontend-test 4/6 3 4 43s
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000777c3290, pid=5632, tid=6656
#
# JRE version: Java(TM) SE Ru
Spring 中提供一些Aware相关de接口,BeanFactoryAware、 ApplicationContextAware、ResourceLoaderAware、ServletContextAware等等,其中最常用到de匙ApplicationContextAware.实现ApplicationContextAwaredeBean,在Bean被初始后,将会被注入 Applicati
在Java项目中,我们通常会自己写一个DateUtil类,处理日期和字符串的转换,如下所示:
public class DateUtil01 {
private SimpleDateFormat dateformat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
public void format(Date d
问题描述:
在实现类中的某一或某几个Override方法发生编译错误如下:
Name clash: The method put(String) of type XXXServiceImpl has the same erasure as put(String) of type XXXService but does not override it
当去掉@Over