mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-08 12:41:58 +00:00
Rename PetSet to StatefulSet in docs and examples.
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
# CockroachDB on Kubernetes as a PetSet
|
||||
# CockroachDB on Kubernetes as a StatefulSet
|
||||
|
||||
This example deploys [CockroachDB](https://cockroachlabs.com) on Kubernetes as
|
||||
a PetSet. CockroachDB is a distributed, scalable NewSQL database. Please see
|
||||
a StatefulSet. CockroachDB is a distributed, scalable NewSQL database. Please see
|
||||
[the homepage](https://cockroachlabs.com) and the
|
||||
[documentation](https://www.cockroachlabs.com/docs/) for details.
|
||||
|
||||
## Limitations
|
||||
|
||||
### PetSet limitations
|
||||
### StatefulSet limitations
|
||||
|
||||
Standard PetSet limitations apply: There is currently no possibility to use
|
||||
Standard StatefulSet limitations apply: There is currently no possibility to use
|
||||
node-local storage (outside of single-node tests), and so there is likely
|
||||
a performance hit associated with running CockroachDB on some external storage.
|
||||
Note that CockroachDB already does replication and thus it is unnecessary to
|
||||
deploy it onto persistent volumes which already replicate internally.
|
||||
For this reason, high-performance use cases on a private Kubernetes cluster
|
||||
may want to consider a DaemonSet deployment until PetSets support node-local
|
||||
may want to consider a DaemonSet deployment until Stateful Sets support node-local
|
||||
storage (see #7562).
|
||||
|
||||
### Recovery after persistent storage failure
|
||||
@@ -43,13 +43,13 @@ Follow the steps in [minikube.sh](minikube.sh) (or simply run that file).
|
||||
## Testing in the cloud on GCE or AWS
|
||||
|
||||
Once you have a Kubernetes cluster running, just run
|
||||
`kubectl create -f cockroachdb-petset.yaml` to create your cockroachdb cluster.
|
||||
`kubectl create -f cockroachdb-statefulset.yaml` to create your cockroachdb cluster.
|
||||
This works because GCE and AWS support dynamic volume provisioning by default,
|
||||
so persistent volumes will be created for the CockroachDB pods as needed.
|
||||
|
||||
## Accessing the database
|
||||
|
||||
Along with our PetSet configuration, we expose a standard Kubernetes service
|
||||
Along with our StatefulSet configuration, we expose a standard Kubernetes service
|
||||
that offers a load-balanced virtual IP for clients to access the database
|
||||
with. In our example, we've called this service `cockroachdb-public`.
|
||||
|
||||
@@ -98,10 +98,10 @@ database and ensuring the other replicas have all data that was written.
|
||||
|
||||
## Scaling up or down
|
||||
|
||||
Simply patch the PetSet by running
|
||||
Simply patch the Stateful Set by running
|
||||
|
||||
```shell
|
||||
kubectl patch petset cockroachdb -p '{"spec":{"replicas":4}}'
|
||||
kubectl patch statefulset cockroachdb -p '{"spec":{"replicas":4}}'
|
||||
```
|
||||
|
||||
Note that you may need to create a new persistent volume claim first. If you
|
||||
@@ -116,7 +116,7 @@ Because all of the resources in this example have been tagged with the label `ap
|
||||
we can clean up everything that we created in one quick command using a selector on that label:
|
||||
|
||||
```shell
|
||||
kubectl delete petsets,pods,persistentvolumes,persistentvolumeclaims,services -l app=cockroachdb
|
||||
kubectl delete statefulsets,pods,persistentvolumes,persistentvolumeclaims,services -l app=cockroachdb
|
||||
```
|
||||
|
||||
|
||||
|
@@ -23,10 +23,10 @@ spec:
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
# This service only exists to create DNS entries for each pet in the petset
|
||||
# such that they can resolve each other's IP addresses. It does not create a
|
||||
# load-balanced ClusterIP and should not be used directly by clients in most
|
||||
# circumstances.
|
||||
# This service only exists to create DNS entries for each pod in the stateful
|
||||
# set such that they can resolve each other's IP addresses. It does not
|
||||
# create a load-balanced ClusterIP and should not be used directly by clients
|
||||
# in most circumstances.
|
||||
name: cockroachdb
|
||||
labels:
|
||||
app: cockroachdb
|
||||
@@ -55,7 +55,7 @@ spec:
|
||||
app: cockroachdb
|
||||
---
|
||||
apiVersion: apps/v1beta1
|
||||
kind: PetSet
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: cockroachdb
|
||||
spec:
|
||||
@@ -71,8 +71,8 @@ spec:
|
||||
# it's started up for the first time. It has to exit successfully
|
||||
# before the pod's main containers are allowed to start.
|
||||
# This particular init container does a DNS lookup for other pods in
|
||||
# the petset to help determine whether or not a cluster already exists.
|
||||
# If any other pets exist, it creates a file in the cockroach-data
|
||||
# the set to help determine whether or not a cluster already exists.
|
||||
# If any other pods exist, it creates a file in the cockroach-data
|
||||
# directory to pass that information along to the primary container that
|
||||
# has to decide what command-line flags to use when starting CockroachDB.
|
||||
# This only matters when a pod's persistent volume is empty - if it has
|
@@ -14,7 +14,7 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# Run the CockroachDB PetSet example on a minikube instance.
|
||||
# Run the CockroachDB StatefulSet example on a minikube instance.
|
||||
#
|
||||
# For a fresh start, run the following first:
|
||||
# minikube delete
|
||||
@@ -29,7 +29,7 @@
|
||||
set -exuo pipefail
|
||||
|
||||
# Clean up anything from a prior run:
|
||||
kubectl delete petsets,pods,persistentvolumes,persistentvolumeclaims,services -l app=cockroachdb
|
||||
kubectl delete statefulsets,pods,persistentvolumes,persistentvolumeclaims,services -l app=cockroachdb
|
||||
|
||||
# Make persistent volumes and (correctly named) claims. We must create the
|
||||
# claims here manually even though that sounds counter-intuitive. For details
|
||||
@@ -69,4 +69,4 @@ spec:
|
||||
EOF
|
||||
done;
|
||||
|
||||
kubectl create -f cockroachdb-petset.yaml
|
||||
kubectl create -f cockroachdb-statefulset.yaml
|
||||
|
Reference in New Issue
Block a user