一、daemonset

1.daemonset1.json

  1. {
  2. "apiVersion": "extensions/v1beta1",
  3. "kind": "DaemonSet",
  4. "metadata": {
  5. "name": "fluentd-elasticsearch",
  6. "namespace": "default",
  7. "labels": {
  8. "k8s-app": "fluentd-logging"
  9. }
  10. },
  11. "spec": {
  12. "selector": {
  13. "matchLabels": {
  14. "name": "fluentd-elasticsearch"
  15. }
  16. },
  17. "template": {
  18. "metadata": {
  19. "labels": {
  20. "name": "fluentd-elasticsearch"
  21. }
  22. },
  23. "spec": {
  24. "tolerations": [
  25. {
  26. "key": "node-role.kubernetes.io/master",
  27. "effect": "NoSchedule"
  28. }
  29. ],
  30. "containers": [
  31. {
  32. "name": "fluentd-elasticsearch",
  33. "image": "quay.io/fluentd_elasticsearch/fluentd:v2.5.2",
  34. "resources": {
  35. "limits": {
  36. "memory": "500Mi"
  37. },
  38. "requests": {
  39. "cpu": "100m",
  40. "memory": "500Mi"
  41. }
  42. },
  43. "volumeMounts": [
  44. {
  45. "name": "varlog",
  46. "mountPath": "/var/log"
  47. },
  48. {
  49. "name": "varlibdockercontainers",
  50. "mountPath": "/var/lib/docker/containers",
  51. "readOnly": true
  52. }
  53. ]
  54. }
  55. ],
  56. "terminationGracePeriodSeconds": 5,
  57. "volumes": [
  58. {
  59. "name": "varlog",
  60. "hostPath": {
  61. "path": "/var/log"
  62. }
  63. },
  64. {
  65. "name": "varlibdockercontainers",
  66. "hostPath": {
  67. "path": "/var/lib/docker/containers"
  68. }
  69. }
  70. ]
  71. }
  72. }
  73. }
  74. }

2.daemonset2.json 校验:/kind

  1. {
  2. "apiVersion": "extensions/v1beta1",
  3. "metadata": {
  4. "name": "fluentd-elasticsearch",
  5. "namespace": "default",
  6. "labels": {
  7. "k8s-app": "fluentd-logging"
  8. }
  9. },
  10. "spec": {
  11. "selector": {
  12. "matchLabels": {
  13. "name": "fluentd-elasticsearch"
  14. }
  15. },
  16. "template": {
  17. "metadata": {
  18. "labels": {
  19. "name": "fluentd-elasticsearch"
  20. }
  21. },
  22. "spec": {
  23. "tolerations": [
  24. {
  25. "key": "node-role.kubernetes.io/master",
  26. "effect": "NoSchedule"
  27. }
  28. ],
  29. "containers": [
  30. {
  31. "name": "fluentd-elasticsearch",
  32. "image": "quay.io/fluentd_elasticsearch/fluentd:v2.5.2",
  33. "resources": {
  34. "limits": {
  35. "memory": "500Mi"
  36. },
  37. "requests": {
  38. "cpu": "100m",
  39. "memory": "500Mi"
  40. }
  41. },
  42. "volumeMounts": [
  43. {
  44. "name": "varlog",
  45. "mountPath": "/var/log"
  46. },
  47. {
  48. "name": "varlibdockercontainers",
  49. "mountPath": "/var/lib/docker/containers",
  50. "readOnly": true
  51. }
  52. ]
  53. }
  54. ],
  55. "terminationGracePeriodSeconds": 5,
  56. "volumes": [
  57. {
  58. "name": "varlog",
  59. "hostPath": {
  60. "path": "/var/log"
  61. }
  62. },
  63. {
  64. "name": "varlibdockercontainers",
  65. "hostPath": {
  66. "path": "/var/lib/docker/containers"
  67. }
  68. }
  69. ]
  70. }
  71. }
  72. }
  73. }

3.daemonset3.json 校验:/apiVersion

  1. {
  2. "kind": "DaemonSet",
  3. "metadata": {
  4. "name": "fluentd-elasticsearch",
  5. "namespace": "default",
  6. "labels": {
  7. "k8s-app": "fluentd-logging"
  8. }
  9. },
  10. "spec": {
  11. "selector": {
  12. "matchLabels": {
  13. "name": "fluentd-elasticsearch"
  14. }
  15. },
  16. "template": {
  17. "metadata": {
  18. "labels": {
  19. "name": "fluentd-elasticsearch"
  20. }
  21. },
  22. "spec": {
  23. "tolerations": [
  24. {
  25. "key": "node-role.kubernetes.io/master",
  26. "effect": "NoSchedule"
  27. }
  28. ],
  29. "containers": [
  30. {
  31. "name": "fluentd-elasticsearch",
  32. "image": "quay.io/fluentd_elasticsearch/fluentd:v2.5.2",
  33. "resources": {
  34. "limits": {
  35. "memory": "500Mi"
  36. },
  37. "requests": {
  38. "cpu": "100m",
  39. "memory": "500Mi"
  40. }
  41. },
  42. "volumeMounts": [
  43. {
  44. "name": "varlog",
  45. "mountPath": "/var/log"
  46. },
  47. {
  48. "name": "varlibdockercontainers",
  49. "mountPath": "/var/lib/docker/containers",
  50. "readOnly": true
  51. }
  52. ]
  53. }
  54. ],
  55. "terminationGracePeriodSeconds": 5,
  56. "volumes": [
  57. {
  58. "name": "varlog",
  59. "hostPath": {
  60. "path": "/var/log"
  61. }
  62. },
  63. {
  64. "name": "varlibdockercontainers",
  65. "hostPath": {
  66. "path": "/var/lib/docker/containers"
  67. }
  68. }
  69. ]
  70. }
  71. }
  72. }
  73. }

4.daemonset4.json 校验:/metadata/name

  1. {
  2. "apiVersion": "extensions/v1beta1",
  3. "kind": "DaemonSet",
  4. "metadata": {
  5. "namespace": "default",
  6. "labels": {
  7. "k8s-app": "fluentd-logging"
  8. }
  9. },
  10. "spec": {
  11. "selector": {
  12. "matchLabels": {
  13. "name": "fluentd-elasticsearch"
  14. }
  15. },
  16. "template": {
  17. "spec": {
  18. "tolerations": [
  19. {
  20. "key": "node-role.kubernetes.io/master",
  21. "effect": "NoSchedule"
  22. }
  23. ],
  24. "containers": [
  25. {
  26. "name": "fluentd-elasticsearch",
  27. "image": "quay.io/fluentd_elasticsearch/fluentd:v2.5.2",
  28. "resources": {
  29. "limits": {
  30. "memory": "500Mi"
  31. },
  32. "requests": {
  33. "cpu": "100m",
  34. "memory": "500Mi"
  35. }
  36. },
  37. "volumeMounts": [
  38. {
  39. "name": "varlog",
  40. "mountPath": "/var/log"
  41. },
  42. {
  43. "name": "varlibdockercontainers",
  44. "mountPath": "/var/lib/docker/containers",
  45. "readOnly": true
  46. }
  47. ]
  48. }
  49. ],
  50. "terminationGracePeriodSeconds": 5,
  51. "volumes": [
  52. {
  53. "name": "varlog",
  54. "hostPath": {
  55. "path": "/var/log"
  56. }
  57. },
  58. {
  59. "name": "varlibdockercontainers",
  60. "hostPath": {
  61. "path": "/var/lib/docker/containers"
  62. }
  63. }
  64. ]
  65. }
  66. }
  67. }
  68. }

5.daemonset5.json 校验:/spec/template/metadata

  1. {
  2. "apiVersion": "extensions/v1beta1",
  3. "kind": "DaemonSet",
  4. "metadata": {
  5. "name": "fluentd-elasticsearch",
  6. "namespace": "default",
  7. "labels": {
  8. "k8s-app": "fluentd-logging"
  9. }
  10. },
  11. "spec": {
  12. "selector": {
  13. "matchLabels": {
  14. "name": "fluentd-elasticsearch"
  15. }
  16. },
  17. "template": {
  18. "spec": {
  19. "tolerations": [
  20. {
  21. "key": "node-role.kubernetes.io/master",
  22. "effect": "NoSchedule"
  23. }
  24. ],
  25. "containers": [
  26. {
  27. "name": "fluentd-elasticsearch",
  28. "image": "quay.io/fluentd_elasticsearch/fluentd:v2.5.2",
  29. "resources": {
  30. "limits": {
  31. "memory": "500Mi"
  32. },
  33. "requests": {
  34. "cpu": "100m",
  35. "memory": "500Mi"
  36. }
  37. },
  38. "volumeMounts": [
  39. {
  40. "name": "varlog",
  41. "mountPath": "/var/log"
  42. },
  43. {
  44. "name": "varlibdockercontainers",
  45. "mountPath": "/var/lib/docker/containers",
  46. "readOnly": true
  47. }
  48. ]
  49. }
  50. ],
  51. "terminationGracePeriodSeconds": 5,
  52. "volumes": [
  53. {
  54. "name": "varlog",
  55. "hostPath": {
  56. "path": "/var/log"
  57. }
  58. },
  59. {
  60. "name": "varlibdockercontainers",
  61. "hostPath": {
  62. "path": "/var/lib/docker/containers"
  63. }
  64. }
  65. ]
  66. }
  67. }
  68. }
  69. }

二、deployment

1.deployment1.json

  1. {
  2. "apiVersion": "apps/v1",
  3. "kind": "Deployment",
  4. "metadata": {
  5. "name": "houtest2-deployment5"
  6. },
  7. "spec": {
  8. "replicas": 3,
  9. "selector": {
  10. "matchLabels": {
  11. "app": "demo"
  12. }
  13. },
  14. "template": {
  15. "metadata": {
  16. "labels": {
  17. "app": "demo"
  18. }
  19. },
  20. "spec": {
  21. "containers": [
  22. {
  23. "name": "web",
  24. "image": "nginx:1.12",
  25. "ports": [
  26. {
  27. "name": "http",
  28. "protocol": "TCP",
  29. "containerPort": 80
  30. }
  31. ]
  32. }
  33. ]
  34. }
  35. }
  36. }
  37. }

2.deployment2.json 校验:/kind

  1. {
  2. "apiVersion": "apps/v1",
  3. "metadata": {
  4. "name": "houtest2-deployment5"
  5. },
  6. "spec": {
  7. "replicas": 3,
  8. "selector": {
  9. "matchLabels": {
  10. "app": "demo"
  11. }
  12. },
  13. "template": {
  14. "metadata": {
  15. "labels": {
  16. "app": "demo"
  17. }
  18. },
  19. "spec": {
  20. "containers": [
  21. {
  22. "name": "web",
  23. "image": "nginx:1.12",
  24. "ports": [
  25. {
  26. "name": "http",
  27. "protocol": "TCP",
  28. "containerPort": 80
  29. }
  30. ]
  31. }
  32. ]
  33. }
  34. }
  35. }
  36. }

3.deployment3.json 校验:/apiVersion

  1. {
  2. "kind": "Deployment",
  3. "metadata": {
  4. "name": "houtest2-deployment5"
  5. },
  6. "spec": {
  7. "replicas": 3,
  8. "selector": {
  9. "matchLabels": {
  10. "app": "demo"
  11. }
  12. },
  13. "template": {
  14. "metadata": {
  15. "labels": {
  16. "app": "demo"
  17. }
  18. },
  19. "spec": {
  20. "containers": [
  21. {
  22. "name": "web",
  23. "image": "nginx:1.12",
  24. "ports": [
  25. {
  26. "name": "http",
  27. "protocol": "TCP",
  28. "containerPort": 80
  29. }
  30. ]
  31. }
  32. ]
  33. }
  34. }
  35. }
  36. }

4.deployment4.json 校验:/metadata/name

  1. {
  2. "apiVersion": "apps/v1",
  3. "kind": "Deployment",
  4. "metadata": {
  5. },
  6. "spec": {
  7. "replicas": 3,
  8. "selector": {
  9. "matchLabels": {
  10. "app": "demo"
  11. }
  12. },
  13. "template": {
  14. "metadata": {
  15. "labels": {
  16. "app": "demo"
  17. }
  18. },
  19. "spec": {
  20. "containers": [
  21. {
  22. "name": "web",
  23. "image": "nginx:1.12",
  24. "ports": [
  25. {
  26. "name": "http",
  27. "protocol": "TCP",
  28. "containerPort": 80
  29. }
  30. ]
  31. }
  32. ]
  33. }
  34. }
  35. }
  36. }

5.deployment5.json 校验:/spec/template

  1. {
  2. "apiVersion": "apps/v1",
  3. "kind": "Deployment",
  4. "metadata": {
  5. "name": "houtest2-deployment5"
  6. },
  7. "spec": {
  8. "replicas": 3,
  9. "selector": {
  10. "matchLabels": {
  11. "app": "demo"
  12. }
  13. }
  14. }
  15. }

三、replicaset

1.replicaset1.json

  1. {
  2. "apiVersion": "extensions/v1beta1",
  3. "kind": "ReplicaSet",
  4. "metadata": {
  5. "name": "tds-replicaset1"
  6. },
  7. "spec": {
  8. "replicas": 5,
  9. "selector": {
  10. "matchLabels": {
  11. "tier": "frontend"
  12. },
  13. "matchExpressions": [
  14. {
  15. "key": "tier",
  16. "operator": "In",
  17. "values": [
  18. "frontend"
  19. ]
  20. }
  21. ]
  22. },
  23. "template": {
  24. "metadata": {
  25. "labels": {
  26. "app": "guestbook",
  27. "tier": "frontend"
  28. }
  29. },
  30. "spec": {
  31. "containers": [
  32. {
  33. "name": "php-redis",
  34. "image": "gcr.io/google_samples/gb-frontend:v3",
  35. "resources": {
  36. "requests": {
  37. "cpu": "100m",
  38. "memory": "100Mi"
  39. }
  40. },
  41. "env": [
  42. {
  43. "name": "GET_HOSTS_FROM",
  44. "value": "dns"
  45. }
  46. ],
  47. "ports": [
  48. {
  49. "containerPort": 81
  50. }
  51. ]
  52. }
  53. ]
  54. }
  55. }
  56. }
  57. }

2.replicaset2.json 校验:/kind

  1. {
  2. "apiVersion": "extensions/v1beta1",
  3. "metadata": {
  4. "name": "tds-replicaset1"
  5. },
  6. "spec": {
  7. "replicas": 5,
  8. "selector": {
  9. "matchLabels": {
  10. "tier": "frontend"
  11. },
  12. "matchExpressions": [
  13. {
  14. "key": "tier",
  15. "operator": "In",
  16. "values": [
  17. "frontend"
  18. ]
  19. }
  20. ]
  21. },
  22. "template": {
  23. "metadata": {
  24. "labels": {
  25. "app": "guestbook",
  26. "tier": "frontend"
  27. }
  28. },
  29. "spec": {
  30. "containers": [
  31. {
  32. "name": "php-redis",
  33. "image": "gcr.io/google_samples/gb-frontend:v3",
  34. "resources": {
  35. "requests": {
  36. "cpu": "100m",
  37. "memory": "100Mi"
  38. }
  39. },
  40. "env": [
  41. {
  42. "name": "GET_HOSTS_FROM",
  43. "value": "dns"
  44. }
  45. ],
  46. "ports": [
  47. {
  48. "containerPort": 81
  49. }
  50. ]
  51. }
  52. ]
  53. }
  54. }
  55. }
  56. }

3.replicaset3.json 校验:/apiVersion

  1. {
  2. "kind": "ReplicaSet",
  3. "metadata": {
  4. "name": "tds-replicaset1"
  5. },
  6. "spec": {
  7. "replicas": 5,
  8. "selector": {
  9. "matchLabels": {
  10. "tier": "frontend"
  11. },
  12. "matchExpressions": [
  13. {
  14. "key": "tier",
  15. "operator": "In",
  16. "values": [
  17. "frontend"
  18. ]
  19. }
  20. ]
  21. },
  22. "template": {
  23. "metadata": {
  24. "labels": {
  25. "app": "guestbook",
  26. "tier": "frontend"
  27. }
  28. },
  29. "spec": {
  30. "containers": [
  31. {
  32. "name": "php-redis",
  33. "image": "gcr.io/google_samples/gb-frontend:v3",
  34. "resources": {
  35. "requests": {
  36. "cpu": "100m",
  37. "memory": "100Mi"
  38. }
  39. },
  40. "env": [
  41. {
  42. "name": "GET_HOSTS_FROM",
  43. "value": "dns"
  44. }
  45. ],
  46. "ports": [
  47. {
  48. "containerPort": 81
  49. }
  50. ]
  51. }
  52. ]
  53. }
  54. }
  55. }
  56. }

4.replicaset4.json 校验:/metadata/name

  1. {
  2. "apiVersion": "extensions/v1beta1",
  3. "kind": "ReplicaSet",
  4. "metadata": {
  5. },
  6. "spec": {
  7. "replicas": 5,
  8. "selector": {
  9. "matchLabels": {
  10. "tier": "frontend"
  11. },
  12. "matchExpressions": [
  13. {
  14. "key": "tier",
  15. "operator": "In",
  16. "values": [
  17. "frontend"
  18. ]
  19. }
  20. ]
  21. },
  22. "template": {
  23. "metadata": {
  24. "labels": {
  25. "app": "guestbook",
  26. "tier": "frontend"
  27. }
  28. },
  29. "spec": {
  30. "containers": [
  31. {
  32. "name": "php-redis",
  33. "image": "gcr.io/google_samples/gb-frontend:v3",
  34. "resources": {
  35. "requests": {
  36. "cpu": "100m",
  37. "memory": "100Mi"
  38. }
  39. },
  40. "env": [
  41. {
  42. "name": "GET_HOSTS_FROM",
  43. "value": "dns"
  44. }
  45. ],
  46. "ports": [
  47. {
  48. "containerPort": 81
  49. }
  50. ]
  51. }
  52. ]
  53. }
  54. }
  55. }
  56. }

5.replicaset5.json 校验:/spec/replicas

  1. {
  2. "apiVersion": "extensions/v1beta1",
  3. "kind": "ReplicaSet",
  4. "metadata": {
  5. "name": "tds-replicaset1"
  6. },
  7. "spec": {
  8. "selector": {
  9. "matchLabels": {
  10. "tier": "frontend"
  11. },
  12. "matchExpressions": [
  13. {
  14. "key": "tier",
  15. "operator": "In",
  16. "values": [
  17. "frontend"
  18. ]
  19. }
  20. ]
  21. },
  22. "template": {
  23. "metadata": {
  24. "labels": {
  25. "app": "guestbook",
  26. "tier": "frontend"
  27. }
  28. },
  29. "spec": {
  30. "containers": [
  31. {
  32. "name": "php-redis",
  33. "image": "gcr.io/google_samples/gb-frontend:v3",
  34. "resources": {
  35. "requests": {
  36. "cpu": "100m",
  37. "memory": "100Mi"
  38. }
  39. },
  40. "env": [
  41. {
  42. "name": "GET_HOSTS_FROM",
  43. "value": "dns"
  44. }
  45. ],
  46. "ports": [
  47. {
  48. "containerPort": 81
  49. }
  50. ]
  51. }
  52. ]
  53. }
  54. }
  55. }
  56. }

6.replicaset6.json 校验:/spec/template/metadata

  1. {
  2. "apiVersion": "extensions/v1beta1",
  3. "kind": "ReplicaSet",
  4. "metadata": {
  5. "name": "tds-replicaset1"
  6. },
  7. "spec": {
  8. "replicas": 5,
  9. "selector": {
  10. "matchLabels": {
  11. "tier": "frontend"
  12. },
  13. "matchExpressions": [
  14. {
  15. "key": "tier",
  16. "operator": "In",
  17. "values": [
  18. "frontend"
  19. ]
  20. }
  21. ]
  22. },
  23. "template": {
  24. "spec": {
  25. "containers": [
  26. {
  27. "name": "php-redis",
  28. "image": "gcr.io/google_samples/gb-frontend:v3",
  29. "resources": {
  30. "requests": {
  31. "cpu": "100m",
  32. "memory": "100Mi"
  33. }
  34. },
  35. "env": [
  36. {
  37. "name": "GET_HOSTS_FROM",
  38. "value": "dns"
  39. }
  40. ],
  41. "ports": [
  42. {
  43. "containerPort": 81
  44. }
  45. ]
  46. }
  47. ]
  48. }
  49. }
  50. }
  51. }

四、service

1.service1.json

  1. {
  2. "kind": "Service",
  3. "apiVersion": "v1",
  4. "metadata": {
  5. "creationTimestamp": "2021-08-09T01:22:23Z",
  6. "labels": {
  7. "env": "dev"
  8. },
  9. "managedFields": [
  10. {
  11. "apiVersion": "v1",
  12. "fieldsType": "FieldsV1",
  13. "fieldsV1": {
  14. "f:metadata": {
  15. "f:labels": {
  16. ".": {},
  17. "f:env": {}
  18. }
  19. },
  20. "f:spec": {
  21. "f:externalTrafficPolicy": {},
  22. "f:ports": {
  23. ".": {},
  24. "k:{\"port\":80,\"protocol\":\"TCP\"}": {
  25. ".": {},
  26. "f:name": {},
  27. "f:port": {},
  28. "f:protocol": {},
  29. "f:targetPort": {}
  30. }
  31. },
  32. "f:selector": {
  33. ".": {},
  34. "f:app": {},
  35. "f:env": {}
  36. },
  37. "f:sessionAffinity": {},
  38. "f:type": {}
  39. }
  40. },
  41. "manager": "main.exe",
  42. "operation": "Update",
  43. "time": "2021-08-10T01:22:23Z"
  44. }
  45. ],
  46. "name": "houtest-service1",
  47. "namespace": "default"
  48. },
  49. "spec": {
  50. "externalTrafficPolicy": "Cluster",
  51. "ports": [
  52. {
  53. "name": "http",
  54. "nodePort": 32535,
  55. "port": 80,
  56. "protocol": "TCP",
  57. "targetPort": 80
  58. }
  59. ],
  60. "selector": {
  61. "app": "demo",
  62. "env": "dev"
  63. },
  64. "sessionAffinity": "None",
  65. "clusterIP": "10.99.154.23",
  66. "type": "NodePort"
  67. },
  68. "status": {
  69. "loadBalancer": {}
  70. }
  71. }

2.service2.json 校验:/kind

  1. {
  2. "kind": "Service",
  3. "metadata": {
  4. "creationTimestamp": "2021-08-09T01:22:23Z",
  5. "labels": {
  6. "env": "dev"
  7. },
  8. "managedFields": [
  9. {
  10. "fieldsType": "FieldsV1",
  11. "fieldsV1": {
  12. "f:metadata": {
  13. "f:labels": {
  14. ".": {},
  15. "f:env": {}
  16. }
  17. },
  18. "f:spec": {
  19. "f:externalTrafficPolicy": {},
  20. "f:ports": {
  21. ".": {},
  22. "k:{\"port\":80,\"protocol\":\"TCP\"}": {
  23. ".": {},
  24. "f:name": {},
  25. "f:port": {},
  26. "f:protocol": {},
  27. "f:targetPort": {}
  28. }
  29. },
  30. "f:selector": {
  31. ".": {},
  32. "f:app": {},
  33. "f:env": {}
  34. },
  35. "f:sessionAffinity": {},
  36. "f:type": {}
  37. }
  38. },
  39. "manager": "main.exe",
  40. "operation": "Update",
  41. "time": "2021-08-10T01:22:23Z"
  42. }
  43. ],
  44. "name": "houtest-service1",
  45. "namespace": "default"
  46. },
  47. "spec": {
  48. "externalTrafficPolicy": "Cluster",
  49. "ports": [
  50. {
  51. "name": "http",
  52. "nodePort": 32535,
  53. "port": 80,
  54. "protocol": "TCP",
  55. "targetPort": 80
  56. }
  57. ],
  58. "selector": {
  59. "app": "demo",
  60. "env": "dev"
  61. },
  62. "sessionAffinity": "None",
  63. "clusterIP": "10.99.154.23",
  64. "type": "NodePort"
  65. },
  66. "status": {
  67. "loadBalancer": {}
  68. }
  69. }

3.service3.json 校验:/apiVersion

  1. {
  2. "apiVersion": "v1",
  3. "metadata": {
  4. "creationTimestamp": "2021-08-09T01:22:23Z",
  5. "labels": {
  6. "env": "dev"
  7. },
  8. "managedFields": [
  9. {
  10. "apiVersion": "v1",
  11. "fieldsType": "FieldsV1",
  12. "fieldsV1": {
  13. "f:metadata": {
  14. "f:labels": {
  15. ".": {},
  16. "f:env": {}
  17. }
  18. },
  19. "f:spec": {
  20. "f:externalTrafficPolicy": {},
  21. "f:ports": {
  22. ".": {},
  23. "k:{\"port\":80,\"protocol\":\"TCP\"}": {
  24. ".": {},
  25. "f:name": {},
  26. "f:port": {},
  27. "f:protocol": {},
  28. "f:targetPort": {}
  29. }
  30. },
  31. "f:selector": {
  32. ".": {},
  33. "f:app": {},
  34. "f:env": {}
  35. },
  36. "f:sessionAffinity": {},
  37. "f:type": {}
  38. }
  39. },
  40. "manager": "main.exe",
  41. "operation": "Update",
  42. "time": "2021-08-10T01:22:23Z"
  43. }
  44. ],
  45. "name": "houtest-service1",
  46. "namespace": "default"
  47. },
  48. "spec": {
  49. "externalTrafficPolicy": "Cluster",
  50. "ports": [
  51. {
  52. "name": "http",
  53. "nodePort": 32535,
  54. "port": 80,
  55. "protocol": "TCP",
  56. "targetPort": 80
  57. }
  58. ],
  59. "selector": {
  60. "app": "demo",
  61. "env": "dev"
  62. },
  63. "sessionAffinity": "None",
  64. "clusterIP": "10.99.154.23",
  65. "type": "NodePort"
  66. },
  67. "status": {
  68. "loadBalancer": {}
  69. }
  70. }

4.service4.json 校验:/metadata/name

  1. {
  2. "apiVersion": "v1",
  3. "kind": "Service",
  4. "metadata": {
  5. "creationTimestamp": "2021-08-09T01:22:23Z",
  6. "labels": {
  7. "env": "dev"
  8. },
  9. "managedFields": [
  10. {
  11. "apiVersion": "v1",
  12. "fieldsType": "FieldsV1",
  13. "fieldsV1": {
  14. "f:metadata": {
  15. "f:labels": {
  16. ".": {},
  17. "f:env": {}
  18. }
  19. },
  20. "f:spec": {
  21. "f:externalTrafficPolicy": {},
  22. "f:ports": {
  23. ".": {},
  24. "k:{\"port\":80,\"protocol\":\"TCP\"}": {
  25. ".": {},
  26. "f:name": {},
  27. "f:port": {},
  28. "f:protocol": {},
  29. "f:targetPort": {}
  30. }
  31. },
  32. "f:selector": {
  33. ".": {},
  34. "f:app": {},
  35. "f:env": {}
  36. },
  37. "f:sessionAffinity": {},
  38. "f:type": {}
  39. }
  40. },
  41. "manager": "main.exe",
  42. "operation": "Update",
  43. "time": "2021-08-10T01:22:23Z"
  44. }
  45. ],
  46. "namespace": "default"
  47. },
  48. "spec": {
  49. "externalTrafficPolicy": "Cluster",
  50. "ports": [
  51. {
  52. "name": "http",
  53. "nodePort": 32535,
  54. "port": 80,
  55. "protocol": "TCP",
  56. "targetPort": 80
  57. }
  58. ],
  59. "selector": {
  60. "app": "demo",
  61. "env": "dev"
  62. },
  63. "sessionAffinity": "None",
  64. "clusterIP": "10.99.154.23",
  65. "type": "NodePort"
  66. },
  67. "status": {
  68. "loadBalancer": {}
  69. }
  70. }

5.service5.json 校验:/metadata/namespace

  1. {
  2. "apiVersion": "v1",
  3. "kind": "Service",
  4. "metadata": {
  5. "creationTimestamp": "2021-08-09T01:22:23Z",
  6. "labels": {
  7. "env": "dev"
  8. },
  9. "managedFields": [
  10. {
  11. "apiVersion": "v1",
  12. "fieldsType": "FieldsV1",
  13. "fieldsV1": {
  14. "f:metadata": {
  15. "f:labels": {
  16. ".": {},
  17. "f:env": {}
  18. }
  19. },
  20. "f:spec": {
  21. "f:externalTrafficPolicy": {},
  22. "f:ports": {
  23. ".": {},
  24. "k:{\"port\":80,\"protocol\":\"TCP\"}": {
  25. ".": {},
  26. "f:name": {},
  27. "f:port": {},
  28. "f:protocol": {},
  29. "f:targetPort": {}
  30. }
  31. },
  32. "f:selector": {
  33. ".": {},
  34. "f:app": {},
  35. "f:env": {}
  36. },
  37. "f:sessionAffinity": {},
  38. "f:type": {}
  39. }
  40. },
  41. "manager": "main.exe",
  42. "operation": "Update",
  43. "time": "2021-08-10T01:22:23Z"
  44. }
  45. ],
  46. "name": "houtest-service1",
  47. },
  48. "spec": {
  49. "externalTrafficPolicy": "Cluster",
  50. "ports": [
  51. {
  52. "name": "http",
  53. "nodePort": 32535,
  54. "port": 80,
  55. "protocol": "TCP",
  56. "targetPort": 80
  57. }
  58. ],
  59. "selector": {
  60. "app": "demo",
  61. "env": "dev"
  62. },
  63. "sessionAffinity": "None",
  64. "clusterIP": "10.99.154.23",
  65. "type": "NodePort"
  66. },
  67. "status": {
  68. "loadBalancer": {}
  69. }
  70. }

6.service6.json 校验:/spec/ports

  1. {
  2. "apiVersion": "v1",
  3. "kind": "Service",
  4. "metadata": {
  5. "creationTimestamp": "2021-08-09T01:22:23Z",
  6. "labels": {
  7. "env": "dev"
  8. },
  9. "managedFields": [
  10. {
  11. "apiVersion": "v1",
  12. "fieldsType": "FieldsV1",
  13. "fieldsV1": {
  14. "f:metadata": {
  15. "f:labels": {
  16. ".": {},
  17. "f:env": {}
  18. }
  19. },
  20. "f:spec": {
  21. "f:externalTrafficPolicy": {},
  22. "f:ports": {
  23. ".": {},
  24. "k:{\"port\":80,\"protocol\":\"TCP\"}": {
  25. ".": {},
  26. "f:name": {},
  27. "f:port": {},
  28. "f:protocol": {},
  29. "f:targetPort": {}
  30. }
  31. },
  32. "f:selector": {
  33. ".": {},
  34. "f:app": {},
  35. "f:env": {}
  36. },
  37. "f:sessionAffinity": {},
  38. "f:type": {}
  39. }
  40. },
  41. "manager": "main.exe",
  42. "operation": "Update",
  43. "time": "2021-08-10T01:22:23Z"
  44. }
  45. ],
  46. "name": "houtest-service1",
  47. "namespace": "default"
  48. },
  49. "spec": {
  50. "externalTrafficPolicy": "Cluster",
  51. "selector": {
  52. "app": "demo",
  53. "env": "dev"
  54. },
  55. "sessionAffinity": "None",
  56. "clusterIP": "10.99.154.23",
  57. "type": "NodePort"
  58. },
  59. "status": {
  60. "loadBalancer": {}
  61. }
  62. }

五、statefulset

1.statefulset1.json

  1. {
  2. "apiVersion": "apps/v1",
  3. "kind": "StatefulSet",
  4. "metadata": {
  5. "name": "tds-web11"
  6. },
  7. "spec": {
  8. "serviceName": "demo-service1",
  9. "replicas": 2,
  10. "selector": {
  11. "matchLabels": {
  12. "app": "nginx"
  13. }
  14. },
  15. "template": {
  16. "metadata": {
  17. "labels": {
  18. "app": "nginx"
  19. }
  20. },
  21. "spec": {
  22. "containers": [
  23. {
  24. "name": "nginx",
  25. "image": "k8s.gcr.io/nginx-slim:0.8",
  26. "ports": [
  27. {
  28. "containerPort": 80,
  29. "name": "web"
  30. }
  31. ],
  32. "volumeMounts": [
  33. {
  34. "name": "www1",
  35. "mountPath": "/usr/share/nginx/html"
  36. }
  37. ]
  38. }
  39. ]
  40. }
  41. }
  42. }
  43. }

2.statefulset2.json 校验:/kind

  1. {
  2. "apiVersion": "apps/v1",
  3. "metadata": {
  4. "name": "tds-web11"
  5. },
  6. "spec": {
  7. "serviceName": "demo-service1",
  8. "replicas": 2,
  9. "selector": {
  10. "matchLabels": {
  11. "app": "nginx"
  12. }
  13. },
  14. "template": {
  15. "metadata": {
  16. "labels": {
  17. "app": "nginx"
  18. }
  19. },
  20. "spec": {
  21. "containers": [
  22. {
  23. "name": "nginx",
  24. "image": "k8s.gcr.io/nginx-slim:0.8",
  25. "ports": [
  26. {
  27. "containerPort": 80,
  28. "name": "web"
  29. }
  30. ],
  31. "volumeMounts": [
  32. {
  33. "name": "www1",
  34. "mountPath": "/usr/share/nginx/html"
  35. }
  36. ]
  37. }
  38. ]
  39. }
  40. }
  41. }
  42. }

3.statefulset3.json 校验:/apiVersion

  1. {
  2. "kind": "StatefulSet",
  3. "metadata": {
  4. "name": "tds-web11"
  5. },
  6. "spec": {
  7. "serviceName": "demo-service1",
  8. "replicas": 2,
  9. "selector": {
  10. "matchLabels": {
  11. "app": "nginx"
  12. }
  13. },
  14. "template": {
  15. "metadata": {
  16. "labels": {
  17. "app": "nginx"
  18. }
  19. },
  20. "spec": {
  21. "containers": [
  22. {
  23. "name": "nginx",
  24. "image": "k8s.gcr.io/nginx-slim:0.8",
  25. "ports": [
  26. {
  27. "containerPort": 80,
  28. "name": "web"
  29. }
  30. ],
  31. "volumeMounts": [
  32. {
  33. "name": "www1",
  34. "mountPath": "/usr/share/nginx/html"
  35. }
  36. ]
  37. }
  38. ]
  39. }
  40. }
  41. }
  42. }

4.statefulset4.json //校验:/metadata/name

  1. {
  2. "apiVersion": "apps/v1",
  3. "kind": "StatefulSet",
  4. "metadata": {
  5. },
  6. "spec": {
  7. "serviceName": "demo-service1",
  8. "replicas": 2,
  9. "selector": {
  10. "matchLabels": {
  11. "app": "nginx"
  12. }
  13. },
  14. "template": {
  15. "metadata": {
  16. "labels": {
  17. "app": "nginx"
  18. }
  19. },
  20. "spec": {
  21. "containers": [
  22. {
  23. "name": "nginx",
  24. "image": "k8s.gcr.io/nginx-slim:0.8",
  25. "ports": [
  26. {
  27. "containerPort": 80,
  28. "name": "web"
  29. }
  30. ],
  31. "volumeMounts": [
  32. {
  33. "name": "www1",
  34. "mountPath": "/usr/share/nginx/html"
  35. }
  36. ]
  37. }
  38. ]
  39. }
  40. }
  41. }
  42. }

5.statefulset5.json 校验:/spec/serviceName

  1. {
  2. "apiVersion": "apps/v1",
  3. "kind": "StatefulSet",
  4. "metadata": {
  5. "name": "tds-web11"
  6. },
  7. "spec": {
  8. "replicas": 2,
  9. "selector": {
  10. "matchLabels": {
  11. "app": "nginx"
  12. }
  13. },
  14. "template": {
  15. "metadata": {
  16. "labels": {
  17. "app": "nginx"
  18. }
  19. },
  20. "spec": {
  21. "containers": [
  22. {
  23. "name": "nginx",
  24. "image": "k8s.gcr.io/nginx-slim:0.8",
  25. "ports": [
  26. {
  27. "containerPort": 80,
  28. "name": "web"
  29. }
  30. ],
  31. "volumeMounts": [
  32. {
  33. "name": "www1",
  34. "mountPath": "/usr/share/nginx/html"
  35. }
  36. ]
  37. }
  38. ]
  39. }
  40. }
  41. }
  42. }

6.statefulset6json 校验:/spec/selector

  1. {
  2. "apiVersion": "apps/v1",
  3. "kind": "StatefulSet",
  4. "metadata": {
  5. "name": "tds-web11"
  6. },
  7. "spec": {
  8. "serviceName": "demo-service1",
  9. "replicas": 2,
  10. "template": {
  11. "metadata": {
  12. "labels": {
  13. "app": "nginx"
  14. }
  15. },
  16. "spec": {
  17. "containers": [
  18. {
  19. "name": "nginx",
  20. "image": "k8s.gcr.io/nginx-slim:0.8",
  21. "ports": [
  22. {
  23. "containerPort": 80,
  24. "name": "web"
  25. }
  26. ],
  27. "volumeMounts": [
  28. {
  29. "name": "www1",
  30. "mountPath": "/usr/share/nginx/html"
  31. }
  32. ]
  33. }
  34. ]
  35. }
  36. }
  37. }
  38. }