{"id":2360,"date":"2017-01-04T19:18:53","date_gmt":"2017-01-04T19:18:52","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=2360"},"modified":"2023-06-21T06:23:31","modified_gmt":"2023-06-21T13:23:31","slug":"stateful-containers-kubernetes-amazon-ebs","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/","title":{"rendered":"Stateful Containers on Kubernetes using Persistent Volume and Amazon EBS"},"content":{"rendered":"<p>This blog will show how to create stateful containers in Kubernetes using Amazon EBS. Couchbase Server is a stateful container. This means that state of the container needs to be carried with it.\u00a0In Kubernetes, the smallest atomic unit of running<br \/>\na container is a pod. So a Couchbase Server container will run as a pod. And by default, all data stored in Couchbase Server is stored on the same host.<br \/>\n<a href=\"\/wp-content\/original-assets\/july2015\/stateful-containers-on-kubernetes-using-persistent-volume-and-amazon-ebs\/kubernetes-pv-couchbase-amazon-storage-1024x600.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-14189\" src=\"\/wp-content\/original-assets\/july2015\/stateful-containers-on-kubernetes-using-persistent-volume-and-amazon-ebs\/kubernetes-pv-couchbase-amazon-storage-1024x600.png\" alt=\"stateful containers\" width=\"604\" height=\"354\" \/><\/a><\/p>\n<p>This figure is originally explained in <a href=\"https:\/\/www.couchbase.com\/blog\/kubernetes-cluster-amazon-expose-service\/\">Kubernetes Cluster on Amazon and Expose Couchbase Service<\/a>. In addition, this\u00a0figure shows storage local to the host.<br \/>\nPods are ephemeral and may be restarted on a different host.\u00a0A <a href=\"https:\/\/kubernetes.io\/docs\/user-guide\/volumes\/\">Kubernetes Volume<\/a> outlives any containers that run within the pod, and data is preserved across container restarts. However<br \/>\nthe volume will cease to exist when a pod ceases to exist. This is solved by Persistent Volumes that provide persistent, cluster-scoped storage for applications that require long lived data.<\/p>\n<div>Creating and using a persistent volume is a three step process:<\/div>\n<div>\n<ol>\n<li><strong>Provision<\/strong>: Administrator provision a networked storage in the cluster, such as\u00a0AWS ElasticBlockStore volumes. This is called as <code>PersistentVolume<\/code>.<\/li>\n<li><strong>Request storage<\/strong>: User requests storage for pods by using <em>claims<\/em>. Claims can specify levels of resources (CPU and memory), specific sizes and access modes (e.g. can be mounted once read\/write or many times write only).<br \/>\nThis is called as <code>PersistentVolumeClaim<\/code>.<\/li>\n<li><strong>Use claim<\/strong>: Claims are mounted as volumes and used in pods for storage.<\/li>\n<\/ol>\n<p>Specifically, this blog will show how to use an\u00a0AWS ElasticBlockStore as <code>PersistentVolume<\/code>, create a <code>PersistentVolumeClaim<\/code>, and then claim it in a pod.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-14190\" src=\"\/wp-content\/original-assets\/july2015\/stateful-containers-on-kubernetes-using-persistent-volume-and-amazon-ebs\/kubernetes-pv-couchbase-amazon-storage-ebs-1024x253.png\" alt=\"stateful containers\" width=\"604\" height=\"149\" \/><\/p>\n<p>Complete source code for this blog is at:\u00a0<a href=\"https:\/\/github.com\/arun-gupta\/couchbase-kubernetes\/\">github.com\/arun-gupta\/couchbase-kubernetes<\/a>.<\/p>\n<h2>Provision AWS Elastic Block Storage<\/h2>\n<p>Following <a href=\"https:\/\/kubernetes.io\/docs\/user-guide\/volumes\/#awselasticblockstore\">restrictions<\/a> need to be met if Amazon ElasticBlockStorage\u00a0is used as a PersistentVolume with Kubernetes:<\/p>\n<ul>\n<li>the nodes on which pods are running must be AWS EC2 instances<\/li>\n<li>those instances need to be in the same region and availability-zone as the EBS volume<\/li>\n<li>EBS only supports a single EC2 instance mounting a volume<\/li>\n<\/ul>\n<p>Create an AWS Elastic Block Storage:<\/p>\n<pre class=\"lang:default decode:true\">aws ec2 create-volume --region us-west-2 --availability-zone us-west-2a --size 5 --volume-type gp2<\/pre>\n<p>The region <code>us-west-2<\/code>\u00a0region and <code>us-west-2a<\/code> availability zone is used here. And so Kubernetes cluster need to start<br \/>\nin the same region and availability zone as well. This shows the output as:<\/p>\n<pre class=\"lang:default decode:true\">{\r\n    \"AvailabilityZone\": \"us-west-2a\", \r\n    \"Encrypted\": false, \r\n    \"VolumeType\": \"gp2\", \r\n    \"VolumeId\": \"vol-47f59cce\", \r\n    \"State\": \"creating\", \r\n    \"Iops\": 100, \r\n    \"SnapshotId\": \"\", \r\n    \"CreateTime\": \"2016-07-29T21:57:43.343Z\", \r\n    \"Size\": 5\r\n}<\/pre>\n<p>Check if the volume is available as:<\/p>\n<pre class=\"lang:default decode:true\">aws --region us-west-2 ec2 describe-volumes --volume-id vol-47f59cce<\/pre>\n<\/div>\n<p>It shows the output as:<\/p>\n<pre class=\"lang:default decode:true\">{\r\n    \"Volumes\": [\r\n        {\r\n            \"AvailabilityZone\": \"us-west-2a\", \r\n            \"Attachments\": [], \r\n            \"Encrypted\": false, \r\n            \"VolumeType\": \"gp2\", \r\n            \"VolumeId\": \"vol-47f59cce\", \r\n            \"State\": \"available\", \r\n            \"Iops\": 100, \r\n            \"SnapshotId\": \"\", \r\n            \"CreateTime\": \"2016-07-29T21:57:43.343Z\", \r\n            \"Size\": 5\r\n        }\r\n    ]\r\n}<\/pre>\n<p>Note the unique identifier for the volume in <code>VolumeId<\/code> attribute. You can also verify the\u00a0EBS block in AWS Console:<\/p>\n<p><a href=\"\/wp-content\/original-assets\/july2015\/stateful-containers-on-kubernetes-using-persistent-volume-and-amazon-ebs\/kubernetes-pv-couchbase-amazon-ebs-1024x432.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-14184\" src=\"\/wp-content\/original-assets\/july2015\/stateful-containers-on-kubernetes-using-persistent-volume-and-amazon-ebs\/kubernetes-pv-couchbase-amazon-ebs-1024x432.png\" alt=\"kubernetes-pv-couchbase-amazon-ebs\" width=\"604\" height=\"255\" \/><\/a><\/p>\n<div>\n<h2>Start Kubernetes Cluster<\/h2>\n<p>Download <a href=\"https:\/\/github.com\/kubernetes\/kubernetes\/releases\/download\/v1.3.3\/kubernetes.tar.gz\">Kubernetes 1.3.3<\/a>, untar it and\u00a0start the cluster on Amazon:<\/p>\n<pre class=\"lang:default decode:true\">export KUBERNETES_PROVIDER=aws\r\nKUBE_AWS_ZONE=us-west-2a NODE_SIZE=m3.large NUM_NODES=3 .\/kubernetes\/cluster\/kube-up.sh<\/pre>\n<p>Three points to note here:<\/p>\n<ul>\n<li>Zone in which the cluster is started is explicitly set\u00a0to <code>us-west-1a<\/code>.\u00a0This matches the zone where EBS storage volume was created.<\/li>\n<li>By default, each node size is <code>m3.medium<\/code>. Here it is\u00a0set\u00a0to\u00a0<code>m3.large<\/code>.<\/li>\n<li>By default, 1 master and 4 worker nodes are created. Here only 3 worker nodes are created.<\/li>\n<\/ul>\n<p>This will show the output as:<\/p>\n<pre class=\"lang:default decode:true\">... Starting cluster in us-west-2a using provider aws\r\n... calling verify-prereqs\r\n... calling kube-up\r\nStarting cluster using os distro: jessie\r\nUploading to Amazon S3\r\n+++ Staging server tars to S3 Storage: kubernetes-staging-0eaf81fbc51209dd47c13b6d8b424149\/devel\r\nupload: ..\/..\/..\/..\/..\/var\/folders\/81\/ttv4n16x7p390cttrm_675y00000gn\/T\/kubernetes.XXXXXX.ISohbaGM\/s3\/bootstrap-script to s3:\/\/kubernetes-staging-0eaf81fbc51209dd47c13b6d8b424149\/devel\/bootstrap-script\r\nUploaded server tars:\r\n  SERVER_BINARY_TAR_URL: https:\/\/s3.amazonaws.com\/kubernetes-staging-0eaf81fbc51209dd47c13b6d8b424149\/devel\/kubernetes-server-linux-amd64.tar.gz\r\n  SALT_TAR_URL: https:\/\/s3.amazonaws.com\/kubernetes-staging-0eaf81fbc51209dd47c13b6d8b424149\/devel\/kubernetes-salt.tar.gz\r\n  BOOTSTRAP_SCRIPT_URL: https:\/\/s3.amazonaws.com\/kubernetes-staging-0eaf81fbc51209dd47c13b6d8b424149\/devel\/bootstrap-script\r\nINSTANCEPROFILE arn:aws:iam::598307997273:instance-profile\/kubernetes-master 2016-07-29T15:13:35Z AIPAJF3XKLNKOXOTQOCTkubernetes-master \/\r\nROLES arn:aws:iam::598307997273:role\/kubernetes-master 2016-07-29T15:13:33Z \/ AROAI3Q2KFBD5PCKRXCRM kubernetes-master\r\nASSUMEROLEPOLICYDOCUMENT 2012-10-17\r\nSTATEMENT sts:AssumeRole Allow\r\nPRINCIPAL ec2.amazonaws.com\r\nINSTANCEPROFILE arn:aws:iam::598307997273:instance-profile\/kubernetes-minion 2016-07-29T15:13:39Z AIPAIYSH5DJA4UPQIP4Bkubernetes-minion \/\r\nROLES arn:aws:iam::598307997273:role\/kubernetes-minion 2016-07-29T15:13:37Z \/ AROAIQ57MPQYSHRPQCT2Q kubernetes-minion\r\nASSUMEROLEPOLICYDOCUMENT 2012-10-17\r\nSTATEMENT sts:AssumeRole Allow\r\nPRINCIPAL ec2.amazonaws.com\r\nUsing SSH key with (AWS) fingerprint: SHA256:dX\/5wpWuUxYar2NFuGwiZuRiydiZCyx4DGoZ5\/jL\/j8\r\nCreating vpc.\r\nAdding tag to vpc-fa3d6c9e: Name=kubernetes-vpc\r\nAdding tag to vpc-fa3d6c9e: KubernetesCluster=kubernetes\r\nUsing VPC vpc-fa3d6c9e\r\nAdding tag to dopt-3aad625e: Name=kubernetes-dhcp-option-set\r\nAdding tag to dopt-3aad625e: KubernetesCluster=kubernetes\r\nUsing DHCP option set dopt-3aad625e\r\nCreating subnet.\r\nAdding tag to subnet-e11f5985: KubernetesCluster=kubernetes\r\nUsing subnet subnet-e11f5985\r\nCreating Internet Gateway.\r\nUsing Internet Gateway igw-5c748f38\r\nAssociating route table.\r\nCreating route table\r\nAdding tag to rtb-84fcf1e0: KubernetesCluster=kubernetes\r\nAssociating route table rtb-84fcf1e0 to subnet subnet-e11f5985\r\nAdding route to route table rtb-84fcf1e0\r\nUsing Route Table rtb-84fcf1e0\r\nCreating master security group.\r\nCreating security group kubernetes-master-kubernetes.\r\nAdding tag to sg-91590bf7: KubernetesCluster=kubernetes\r\nCreating minion security group.\r\nCreating security group kubernetes-minion-kubernetes.\r\nAdding tag to sg-9d590bfb: KubernetesCluster=kubernetes\r\nUsing master security group: kubernetes-master-kubernetes sg-91590bf7\r\nUsing minion security group: kubernetes-minion-kubernetes sg-9d590bfb\r\nCreating master disk: size 20GB, type gp2\r\nAdding tag to vol-def79e57: Name=kubernetes-master-pd\r\nAdding tag to vol-def79e57: KubernetesCluster=kubernetes\r\nAllocated Elastic IP for master: 52.40.216.69\r\nAdding tag to vol-def79e57: kubernetes.io\/master-ip=52.40.216.69\r\nGenerating certs for alternate-names: IP:52.40.216.69,IP:172.20.0.9,IP:10.0.0.1,DNS:kubernetes,DNS:kubernetes.default,DNS:kubernetes.default.svc,DNS:kubernetes.default.svc.cluster.local,DNS:kubernetes-master\r\nStarting Master\r\nAdding tag to i-5a7cebf5: Name=kubernetes-master\r\nAdding tag to i-5a7cebf5: Role=kubernetes-master\r\nAdding tag to i-5a7cebf5: KubernetesCluster=kubernetes\r\nWaiting for master to be ready\r\nAttempt 1 to check for master nodeWaiting for instance i-5a7cebf5 to be running (currently pending)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-5a7cebf5 to be running (currently pending)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-5a7cebf5 to be running (currently pending)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-5a7cebf5 to be running (currently pending)\r\nSleeping for 3 seconds...\r\n [master running]\r\nAttaching IP 52.40.216.69 to instance i-5a7cebf5\r\nAttaching persistent data volume (vol-def79e57) to master\r\n2016-07-29T22:00:36.909Z \/dev\/sdb i-5a7cebf5 attaching vol-def79e57\r\ncluster \"aws_kubernetes\" set.\r\nuser \"aws_kubernetes\" set.\r\ncontext \"aws_kubernetes\" set.\r\nswitched to context \"aws_kubernetes\".\r\nuser \"aws_kubernetes-basic-auth\" set.\r\nWrote config for aws_kubernetes to \/Users\/arungupta\/.kube\/config\r\nCreating minion configuration\r\nCreating autoscaling group\r\n 0 minions started; waiting\r\n 0 minions started; waiting\r\n 0 minions started; waiting\r\n 0 minions started; waiting\r\n 3 minions started; ready\r\nWaiting for cluster initialization.\r\n\r\n  This will continually check to see if the API for kubernetes is reachable.\r\n  This might loop forever if there was some uncaught error during start\r\n  up.\r\n\r\n..........................................................................................................................................................................................................Kubernetes cluster created.\r\nSanity checking cluster...\r\nAttempt 1 to check Docker on node @ 52.42.0.65 ...not working yet\r\nAttempt 2 to check Docker on node @ 52.42.0.65 ...not working yet\r\nAttempt 3 to check Docker on node @ 52.42.0.65 ...working\r\nAttempt 1 to check Docker on node @ 52.36.195.201 ...working\r\nAttempt 1 to check Docker on node @ 52.43.35.173 ...working\r\n\r\nKubernetes cluster is running.  The master is running at:\r\n\r\n  https:\/\/52.40.216.69\r\n\r\nThe user name and password to use is located in \/Users\/arungupta\/.kube\/config.\r\n\r\n... calling validate-cluster\r\nFound 3 node(s).\r\nNAME                                        STATUS    AGE\r\nip-172-20-0-26.us-west-2.compute.internal   Ready     1m\r\nip-172-20-0-27.us-west-2.compute.internal   Ready     1m\r\nip-172-20-0-28.us-west-2.compute.internal   Ready     1m\r\nValidate output:\r\nNAME                 STATUS    MESSAGE              ERROR\r\ncontroller-manager   Healthy   ok                   \r\nscheduler            Healthy   ok                   \r\netcd-0               Healthy   {\"health\": \"true\"}   \r\netcd-1               Healthy   {\"health\": \"true\"}   \r\nCluster validation succeeded\r\nDone, listing cluster services:\r\n\r\nKubernetes master is running at https:\/\/52.40.216.69\r\nElasticsearch is running at https:\/\/52.40.216.69\/api\/v1\/proxy\/namespaces\/kube-system\/services\/elasticsearch-logging\r\nHeapster is running at https:\/\/52.40.216.69\/api\/v1\/proxy\/namespaces\/kube-system\/services\/heapster\r\nKibana is running at https:\/\/52.40.216.69\/api\/v1\/proxy\/namespaces\/kube-system\/services\/kibana-logging\r\nKubeDNS is running at https:\/\/52.40.216.69\/api\/v1\/proxy\/namespaces\/kube-system\/services\/kube-dns\r\nkubernetes-dashboard is running at https:\/\/52.40.216.69\/api\/v1\/proxy\/namespaces\/kube-system\/services\/kubernetes-dashboard\r\nGrafana is running at https:\/\/52.40.216.69\/api\/v1\/proxy\/namespaces\/kube-system\/services\/monitoring-grafana\r\nInfluxDB is running at https:\/\/52.40.216.69\/api\/v1\/proxy\/namespaces\/kube-system\/services\/monitoring-influxdb\r\n\r\nTo further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.<\/pre>\n<p>Read more details about\u00a0starting a <a href=\"https:\/\/www.couchbase.com\/blog\/kubernetes-cluster-amazon-expose-service\/\">Kubernetes cluster on Amazon<\/a>.<\/p>\n<h2>Couchbase Server Pod w\/o Persistent Storage<\/h2>\n<p>Let&#8217;s create a Couchbase Server pod without persistent storage. This means that if the pod is rescheduled on a different host then it will not have access to the data\u00a0created on\u00a0it. Here are quick steps to\u00a0run a Couchbase Server pod and<br \/>\nexpose it outside the cluster:<\/p>\n<pre class=\"lang:default decode:true\">kubectl.sh run couchbase --image=arungupta\/couchbase\r\nkubectl.sh expose deployment couchbase --target-port=8091 --port=8091 --type=LoadBalancer\r\nkubectl.sh describe svc couchbase<\/pre>\n<\/div>\n<p>Read more details at <a href=\"https:\/\/www.couchbase.com\/blog\/kubernetes-cluster-amazon-expose-service\/\">Kubernetes\u00a0cluster at Amazon<\/a>. The last command shows the ingress load balancer\u00a0address. Access Couchbase Server Web Console at <code>:8091<\/code>.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-14174\" src=\"\/wp-content\/original-assets\/july2015\/stateful-containers-on-kubernetes-using-persistent-volume-and-amazon-ebs\/kubernetes-pv-couchbase-amazon-elb.png\" alt=\"kubernetes-pv-couchbase-amazon-elb\" width=\"904\" height=\"517\" \/><\/p>\n<p>Login to the console using <code>Administrator<\/code> login and <code>password<\/code> password. The main page of Couchbase Server Web Console shows up:<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-2715\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/01\/kubernetes-pv-couchbase-amazon-web-console-1024x682.png\" alt=\" kubernetes-pv-couchbase-amazon-web-console-\" width=\"1024\" height=\"682\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/01\/kubernetes-pv-couchbase-amazon-web-console-1024x682.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/01\/kubernetes-pv-couchbase-amazon-web-console-1024x682-300x200.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/01\/kubernetes-pv-couchbase-amazon-web-console-1024x682-768x512.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/01\/kubernetes-pv-couchbase-amazon-web-console-1024x682-400x267.png 400w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/01\/kubernetes-pv-couchbase-amazon-web-console-1024x682-450x300.png 450w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/01\/kubernetes-pv-couchbase-amazon-web-console-1024x682-20x13.png 20w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/p>\n<p>A default <code>travel-sample<\/code> bucket is already created by <a href=\"https:\/\/github.com\/arun-gupta\/docker-images\/tree\/master\/couchbase\">arungupta\/couchbase<\/a> image. This bucket\u00a0is shown in the\u00a0<code>Data Buckets<\/code> tab:<\/p>\n<p><a href=\"https:\/\/blog.arungupta.me\/wp-content\/uploads\/2016\/07\/kubernetes-pv-couchbase-amazon-databucket.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14177 size-large\" src=\"\/wp-content\/original-assets\/july2015\/stateful-containers-on-kubernetes-using-persistent-volume-and-amazon-ebs\/kubernetes-pv-couchbase-amazon-databucket-e1469836235986-1024x266.png\" alt=\"kubernetes-pv-couchbase-amazon-databucket\" width=\"604\" height=\"157\" \/><\/a><\/p>\n<p>Click on <code>Create New Data Bucket<\/code> button to create a new data bucket.\u00a0Give it a name <code>k8s<\/code>, take all the defaults, and click on <code>Create<\/code> button to create the bucket:<\/p>\n<p><a href=\"\/wp-content\/original-assets\/july2015\/stateful-containers-on-kubernetes-using-persistent-volume-and-amazon-ebs\/kubernetes-pv-couchbase-amazon-k8s-bucket-e1469836289564-1024x577.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14180 size-large\" src=\"\/wp-content\/original-assets\/july2015\/stateful-containers-on-kubernetes-using-persistent-volume-and-amazon-ebs\/kubernetes-pv-couchbase-amazon-k8s-bucket-e1469836289564-1024x577.png\" alt=\"kubernetes-pv-couchbase-amazon-k8s-bucket\" width=\"604\" height=\"340\" \/><\/a><\/p>\n<p>Created bucket\u00a0is shown in the <code>Data Buckets<\/code> tab:<\/p>\n<p><a href=\"\/wp-content\/original-assets\/july2015\/stateful-containers-on-kubernetes-using-persistent-volume-and-amazon-ebs\/kubernetes-pv-couchbase-amazon-k8s-bucket-created-e1469836392351-1024x322.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14179 size-large\" src=\"\/wp-content\/original-assets\/july2015\/stateful-containers-on-kubernetes-using-persistent-volume-and-amazon-ebs\/kubernetes-pv-couchbase-amazon-k8s-bucket-created-e1469836392351-1024x322.png\" alt=\"kubernetes-pv-couchbase-amazon-k8s-bucket-created\" width=\"604\" height=\"190\" \/><\/a><\/p>\n<p>Check status of\u00a0the pod:<\/p>\n<pre class=\"lang:default decode:true\">kubectl.sh get po\r\nNAME                         READY     STATUS    RESTARTS   AGE\r\ncouchbase-2646907196-memz2   1\/1       Running   0          53m<\/pre>\n<p>Delete the pod:<\/p>\n<pre class=\"lang:default decode:true\">kubectl.sh delete po couchbase-2646907196-memz2\r\npod \"couchbase-2646907196-memz2\" deleted<\/pre>\n<p>Watch the new pod being created:<\/p>\n<pre class=\"lang:default decode:true\">kubectl.sh get -w po\r\nNAME                         READY     STATUS        RESTARTS   AGE\r\ncouchbase-2646907196-memz2   1\/1       Terminating   0          53m\r\ncouchbase-2646907196-wo6ve   1\/1       Running       0          3s<\/pre>\n<p>Access the Web Console again and see that the\u00a0bucket does not exist:<\/p>\n<p><a href=\"https:\/\/blog.arungupta.me\/wp-content\/uploads\/2016\/07\/kubernetes-pv-couchbase-amazon-k8s-bucket-gone.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14182 size-large\" src=\"\/wp-content\/original-assets\/july2015\/stateful-containers-on-kubernetes-using-persistent-volume-and-amazon-ebs\/kubernetes-pv-couchbase-amazon-k8s-bucket-gone-e1469836489966-1024x275.png\" alt=\"kubernetes-pv-couchbase-amazon-k8s-bucket-gone\" width=\"604\" height=\"162\" \/><\/a><\/p>\n<p>Let&#8217;s clean up the resources created:<\/p>\n<pre class=\"lang:default decode:true\">kubectl.sh delete svc couchbase\r\nkubectl.sh delete deployment couchbase<\/pre>\n<div>\n<h2>Couchbase Server Pod\u00a0with Persistent Storage<\/h2>\n<p>Now, lets\u00a0expose a Couchbase Server pod with persistent storage. As discussed above,\u00a0lets\u00a0create a <code>PersistentVolume<\/code> and claim the volume.<\/p>\n<h3>Request storage<\/h3>\n<p>Like any other Kubernetes resources, a persistent volume\u00a0is created\u00a0by using a resource description file:<\/p>\n<pre class=\"lang:default decode:true\">kind: PersistentVolume\r\napiVersion: v1\r\nmetadata:\r\n  name: couchbase-pv\r\n  labels:\r\n    type: amazonEBS\r\nspec:\r\n  capacity:\r\n    storage: 5Gi\r\n  accessModes:\r\n    - ReadWriteOnce\r\n  awsElasticBlockStore:\r\n    volumeID: vol-47f59cce\r\n    fsType: ext4<\/pre>\n<p>The important pieces\u00a0of information here are:<\/p>\n<ul>\n<li>Creating a storage of\u00a05 GB<\/li>\n<li>Storage can be mounted by only one node for reading\/writing<\/li>\n<li>specifies the volume id created earlier<\/li>\n<\/ul>\n<p>Read more details about definition of this file at\u00a0<a href=\"https:\/\/kubernetes.io\/docs\/user-guide\/persistent-volumes\/\">kubernetes.io\/docs\/user-guide\/persistent-volumes\/<\/a>. This file is available at:\u00a0<a href=\"https:\/\/github.com\/arun-gupta\/couchbase-kubernetes\/blob\/master\/pv\/couchbase-pv.yml\">github.com\/arun-gupta\/couchbase-kubernetes\/blob\/master\/pv\/couchbase-pv.yml<\/a>.<br \/>\nThe volume itself can be\u00a0created as:<\/p>\n<pre class=\"lang:default decode:true\">kubectl create -f couchbase-pv.yml<\/pre>\n<p>and shows the\u00a0output:<\/p>\n<pre class=\"lang:default decode:true\">persistentvolume \"couchbase-pv\" created<\/pre>\n<h3>Use claim<\/h3>\n<p>A<code> PersistentVolumeClaim<\/code> can be created using this resource file:<\/p>\n<\/div>\n<pre class=\"lang:default decode:true\">kind: PersistentVolumeClaim\r\napiVersion: v1\r\nmetadata:\r\n  name: couchbase-pvc\r\n  labels:\r\n    type: amazonEBS\r\nspec:\r\n  accessModes:\r\n    - ReadWriteOnce\r\n  resources:\r\n    requests:\r\n      storage: 5Gi<\/pre>\n<p>In our\u00a0case, both PersistentVolume and PersistentVolumeClaim are 5 GB but they don&#8217;t have to be. Read more details about definition of this file at <a href=\"https:\/\/kubernetes.io\/docs\/user-guide\/persistent-volumes\/#persistentvolumeclaims\">kubernetes.io\/docs\/user-guide\/persistent-volumes\/#persistentvolumeclaims<\/a>.<br \/>\nThis file is at\u00a0<a href=\"https:\/\/github.com\/arun-gupta\/couchbase-kubernetes\/blob\/master\/pv\/couchbase-pvc.yml\">github.com\/arun-gupta\/couchbase-kubernetes\/blob\/master\/pv\/couchbase-pvc.yml<\/a>. The claim can be created as:<\/p>\n<pre class=\"lang:default decode:true\">kubectl create -f couchbase-pvc.yml<\/pre>\n<p>and shows the output:<\/p>\n<pre class=\"lang:default decode:true\">persistentvolumeclaim \"couchbase-pvc\" created<\/pre>\n<div>\n<h3>Create RC\u00a0with Persistent Volume Claim<\/h3>\n<p>Create a Couchbase Replication Controller using this resource file:<\/p>\n<\/div>\n<pre class=\"lang:default decode:true\">apiVersion: v1\r\nkind: ReplicationController\r\nmetadata:\r\n  name: couchbase\r\nspec:\r\n  replicas: 1\r\n  template:\r\n    metadata:\r\n      name: couchbase-rc-pod\r\n      labels:\r\n        name: couchbase-rc-pod\r\n        context: couchbase-pv\r\n    spec:\r\n      containers:\r\n      - name: couchbase-rc-pod\r\n        image: arungupta\/couchbase\r\n        volumeMounts:\r\n        - mountPath: \"\/opt\/couchbase\/var\"\r\n          name: mypd\r\n        ports:\r\n        - containerPort: 8091\r\n        - containerPort: 8092\r\n        - containerPort: 8093\r\n        - containerPort: 11210\r\n      volumes:\r\n      - name: mypd\r\n        persistentVolumeClaim:\r\n          claimName: couchbase-pvc<\/pre>\n<p>Key parts here are:<\/p>\n<ul>\n<li>Resource defines a Replication Controller using <code>arungupta\/couchbase<\/code> Docker image<\/li>\n<li><code>volumeMounts<\/code>\u00a0define which volumes are going to be mounted. <code>\/opt\/couchbase\/var<\/code> is the directory where\u00a0Couchbase Server stores all the data.<\/li>\n<li><code>volumes<\/code>\u00a0define different\u00a0volumes that can be used in this RC definition<\/li>\n<\/ul>\n<p>Create the RC as:<\/p>\n<pre class=\"lang:default decode:true\">kubectl create -f couchbase-rc.yml<\/pre>\n<p>and shows the output:<\/p>\n<pre class=\"lang:default decode:true\">replicationcontroller \"couchbase\" created<\/pre>\n<p>Check for pod as\u00a0<code>kubectl.sh get -w po<\/code> to see:<\/p>\n<pre class=\"lang:default decode:true\">kubectl.sh get -w po\r\nNAME              READY     STATUS              RESTARTS   AGE\r\ncouchbase-jx3fn   0\/1       ContainerCreating   0          3s\r\nNAME              READY     STATUS    RESTARTS   AGE\r\ncouchbase-jx3fn   1\/1       Running   0          20s<\/pre>\n<p>Expose RC as a service:<\/p>\n<pre class=\"lang:default decode:true\">kubectl.sh expose rc couchbase --target-port=8091 --port=809--type=LoadBalancer\r\nservice \"couchbase\" exposed<\/pre>\n<p>Get all the services:<\/p>\n<pre class=\"lang:default decode:true\">kubectl.sh get svc\r\nNAME         CLUSTER-IP    EXTERNAL-IP        PORT(S)    AGE\r\ncouchbase    10.0.49.129   a6179426155e2...   8091\/TCP   19s\r\nkubernetes   10.0.0.1                   443\/TCP    1h<\/pre>\n<p>Describe the service as <code>kubectl.sh describe svc couchbase<\/code>\u00a0to see:<\/p>\n<pre class=\"lang:default decode:true\">Name:   couchbase\r\nNamespace:  default\r\nLabels:   context=couchbase-pv\r\n   name=couchbase-pod\r\nSelector:  context=couchbase-pv,name=couchbase-pod\r\nType:   LoadBalancer\r\nIP:   10.0.49.129\r\nLoadBalancer Ingress: a6179426155e211e6b664022b850255f-1850736155.us-west-2.elb.amazonaws.com\r\nPort:    8091\/TCP\r\nNodePort:   31636\/TCP\r\nEndpoints:  10.244.1.3:8091\r\nSession Affinity: None\r\nEvents:\r\n  FirstSeen LastSeen Count From   SubobjectPath Type  Reason   Message\r\n  --------- -------- ----- ----   ------------- -------- ------   -------\r\n  31s  31s  1 {service-controller }   Normal  CreatingLoadBalancer Creating load balancer\r\n  29s  29s  1 {service-controller }   Normal  CreatedLoadBalancer Created load balancer<\/pre>\n<p>Wait for ~3 mins for the load balancer to settle. Access the Couchbase Server Web Console at <code>:8091<\/code>. Once again, only\u00a0<code>travel-sample<\/code> bucket exists.\u00a0This is created by <code>arungupta\/couchbase<\/code> image used in the RC definition.<\/p>\n<h3>Show Stateful Containers<\/h3>\n<p>Lets create a new bucket. Give it a name <code>kubernetes-pv<\/code>, take all defaults and click on Create button to create the bucket.<\/p>\n<p><a href=\"https:\/\/blog.arungupta.me\/wp-content\/uploads\/2016\/07\/kubernetes-pv-couchbase-amazon-kubernetes-pv-bucket.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14183 size-large\" src=\"\/wp-content\/original-assets\/july2015\/stateful-containers-on-kubernetes-using-persistent-volume-and-amazon-ebs\/kubernetes-pv-couchbase-amazon-kubernetes-pv-bucket-e1469859479150-1024x495.png\" alt=\"kubernetes-pv-couchbase-amazon-kubernetes-pv-bucket\" width=\"604\" height=\"292\" \/><\/a><\/p>\n<p>The bucket now shows up in the console:<\/p>\n<p><a href=\"\/wp-content\/original-assets\/july2015\/stateful-containers-on-kubernetes-using-persistent-volume-and-amazon-ebs\/kubernetes-pv-couchbase-amazon-kubernetes-pv-bucket-created-e1469859541520-1024x330.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14178 size-large\" src=\"\/wp-content\/original-assets\/july2015\/stateful-containers-on-kubernetes-using-persistent-volume-and-amazon-ebs\/kubernetes-pv-couchbase-amazon-kubernetes-pv-bucket-created-e1469859541520-1024x330.png\" alt=\"kubernetes-pv-couchbase-amazon-kubernetes-pv-bucket-created\" width=\"604\" height=\"195\" \/><\/a><\/p>\n<p>Terminate Couchbase Server pod\u00a0and see the state getting restored. Get the pods again:<\/p>\n<pre class=\"lang:default decode:true\">kubectl.sh get po\r\nNAME              READY     STATUS    RESTARTS   AGE\r\ncouchbase-jx3fn   1\/1       Running   0          7m<\/pre>\n<p>Delete the pod:<\/p>\n<pre class=\"lang:default decode:true\">kubectl.sh delete po couchbase-jx3fn\r\npod \"couchbase-jx3fn\" deleted<\/pre>\n<p>Pod gets recreated:<\/p>\n<pre class=\"lang:default decode:true\">kubectl.sh get -w po\r\nNAME              READY     STATUS              RESTARTS   AGE\r\ncouchbase-jx3fn   1\/1       Terminating         0          8m\r\ncouchbase-qq6wu   0\/1       ContainerCreating   0          4s\r\nNAME              READY     STATUS    RESTARTS   AGE\r\ncouchbase-qq6wu   1\/1       Running   0          5s<\/pre>\n<p>And now when you access the Couchbase Web Console, the earlier created bucket still exists:<\/p>\n<p><a href=\"https:\/\/blog.arungupta.me\/wp-content\/uploads\/2016\/07\/kubernetes-pv-couchbase-amazon-kubernetes-pv-bucket-still-there.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-14181 size-large\" src=\"\/wp-content\/original-assets\/july2015\/stateful-containers-on-kubernetes-using-persistent-volume-and-amazon-ebs\/kubernetes-pv-couchbase-amazon-kubernetes-pv-bucket-still-there-e1469859700150-1024x333.png\" alt=\"kubernetes-pv-couchbase-amazon-kubernetes-pv-bucket-still-there\" width=\"604\" height=\"196\" \/><\/a><\/p>\n<p>That&#8217;s because\u00a0the data was stored in the backing EBS storage.<\/p>\n<h2>Cleanup\u00a0Kubernetes Cluster<\/h2>\n<p>Shutdown Kubernetes cluster:<\/p>\n<pre class=\"lang:default decode:true\">KUBE_AWS_ZONE=us-west-2a NODE_SIZE=m3.large NUM_NODES=3 .\/kubernetes\/cluster\/kube-down.sh \r\nBringing down cluster using provider: aws\r\nDeleting ELBs in: vpc-fa3d6c9e\r\nWaiting for ELBs to be deleted\r\nAll ELBs deleted\r\nDeleting instances in VPC: vpc-fa3d6c9e\r\nDeleting auto-scaling group: kubernetes-minion-group-us-west-2a\r\nDeleting auto-scaling launch configuration: kubernetes-minion-group-us-west-2a\r\nDeleting auto-scaling group: kubernetes-minion-group-us-west-2a\r\nDeleting auto-scaling group: kubernetes-minion-group-us-west-2a\r\nWaiting for instances to be deleted\r\nWaiting for instance i-8b7aed24 to be terminated (currently shutting-down)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-8b7aed24 to be terminated (currently shutting-down)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-8b7aed24 to be terminated (currently shutting-down)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-8b7aed24 to be terminated (currently shutting-down)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-8b7aed24 to be terminated (currently shutting-down)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-8b7aed24 to be terminated (currently shutting-down)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-8b7aed24 to be terminated (currently shutting-down)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-8b7aed24 to be terminated (currently shutting-down)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-8b7aed24 to be terminated (currently shutting-down)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-8b7aed24 to be terminated (currently shutting-down)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-8b7aed24 to be terminated (currently shutting-down)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-8b7aed24 to be terminated (currently shutting-down)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-8b7aed24 to be terminated (currently shutting-down)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-8b7aed24 to be terminated (currently shutting-down)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-8b7aed24 to be terminated (currently shutting-down)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-8b7aed24 to be terminated (currently shutting-down)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-8b7aed24 to be terminated (currently shutting-down)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-8b7aed24 to be terminated (currently shutting-down)\r\nSleeping for 3 seconds...\r\nWaiting for instance i-8b7aed24 to be terminated (currently shutting-down)\r\nSleeping for 3 seconds...\r\nAll instances deleted\r\nReleasing Elastic IP: 52.40.216.69\r\nDeleting volume vol-def79e57\r\nCleaning up resources in VPC: vpc-fa3d6c9e\r\nCleaning up security group: sg-91590bf7\r\nCleaning up security group: sg-9d590bfb\r\nCleaning up security group: sg-e97b298f\r\nDeleting security group: sg-91590bf7\r\nDeleting security group: sg-9d590bfb\r\nDeleting security group: sg-e97b298f\r\nDeleting VPC: vpc-fa3d6c9e\r\nDone<\/pre>\n<p>And detach the volume:<\/p>\n<pre class=\"lang:default decode:true\">aws ec2 delete-volume --region us-west-2 --volume-id vol-47f59cce<\/pre>\n<p>Complete source code for this blog is at:\u00a0<a href=\"https:\/\/github.com\/arun-gupta\/couchbase-kubernetes\/\">github.com\/arun-gupta\/couchbase-kubernetes<\/a>.<\/p>\n<p>Enjoy!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This blog will show how to create stateful containers in Kubernetes using Amazon EBS. Couchbase Server is a stateful container. This means that state of the container needs to be carried with it.\u00a0In Kubernetes, the smallest atomic unit of running [&hellip;]<\/p>\n","protected":false},"author":58,"featured_media":13873,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[1816],"tags":[],"ppma_author":[8933],"class_list":["post-2360","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-couchbase-server"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v25.7.1 (Yoast SEO v25.7) - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Stateful Containers on Kubernetes using Persistent Volume and Amazon EBS - The Couchbase Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Stateful Containers on Kubernetes using Persistent Volume and Amazon EBS\" \/>\n<meta property=\"og:description\" content=\"This blog will show how to create stateful containers in Kubernetes using Amazon EBS. Couchbase Server is a stateful container. This means that state of the container needs to be carried with it.\u00a0In Kubernetes, the smallest atomic unit of running [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-04T19:18:52+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-06-21T13:23:31+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/01\/kubernetes-pv-couchbase-amazon-web-console-1024x682.png\" \/>\n<meta name=\"author\" content=\"Arun Gupta, VP, Developer Advocacy, Couchbase\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@arungupta\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Arun Gupta, VP, Developer Advocacy, Couchbase\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"13 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/\"},\"author\":{\"name\":\"Arun Gupta, VP, Developer Advocacy, Couchbase\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/39d8caed0f536489b6aa6e8d31ee631f\"},\"headline\":\"Stateful Containers on Kubernetes using Persistent Volume and Amazon EBS\",\"datePublished\":\"2017-01-04T19:18:52+00:00\",\"dateModified\":\"2023-06-21T13:23:31+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/\"},\"wordCount\":1061,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"articleSection\":[\"Couchbase Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/\",\"name\":\"Stateful Containers on Kubernetes using Persistent Volume and Amazon EBS - The Couchbase Blog\",\"isPartOf\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"datePublished\":\"2017-01-04T19:18:52+00:00\",\"dateModified\":\"2023-06-21T13:23:31+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/#primaryimage\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png\",\"width\":1800,\"height\":630},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.couchbase.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Stateful Containers on Kubernetes using Persistent Volume and Amazon EBS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#website\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\/\/www.couchbase.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"contentUrl\":\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/39d8caed0f536489b6aa6e8d31ee631f\",\"name\":\"Arun Gupta, VP, Developer Advocacy, Couchbase\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/8900a75409c646948fe0bd80f6240337\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/f912e10b5f39748ee4f1a0b0da6f42747f0b3a94fe7acb511791468656f5e726?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/f912e10b5f39748ee4f1a0b0da6f42747f0b3a94fe7acb511791468656f5e726?s=96&d=mm&r=g\",\"caption\":\"Arun Gupta, VP, Developer Advocacy, Couchbase\"},\"description\":\"Arun Gupta is the vice president of developer advocacy at Couchbase. He has built and led developer communities for 10+ years at Sun, Oracle, and Red Hat. He has deep expertise in leading cross-functional teams to develop and execute strategy, planning and execution of content, marketing campaigns, and programs. Prior to that he led engineering teams at Sun and is a founding member of the Java EE team. Gupta has authored more than 2,000 blog posts on technology. He has extensive speaking experience in more than 40 countries on myriad topics and is a JavaOne Rock Star for three years in a row. Gupta also founded the Devoxx4Kids chapter in the US and continues to promote technology education among children. An author of several books on technology, an avid runner, a globe trotter, a Java Champion, a JUG leader, NetBeans Dream Team member, and a Docker Captain, he is easily accessible at @arungupta.\",\"sameAs\":[\"https:\/\/x.com\/arungupta\"],\"url\":\"https:\/\/www.couchbase.com\/blog\/author\/arun-gupta\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Stateful Containers on Kubernetes using Persistent Volume and Amazon EBS - The Couchbase Blog","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/","og_locale":"en_US","og_type":"article","og_title":"Stateful Containers on Kubernetes using Persistent Volume and Amazon EBS","og_description":"This blog will show how to create stateful containers in Kubernetes using Amazon EBS. Couchbase Server is a stateful container. This means that state of the container needs to be carried with it.\u00a0In Kubernetes, the smallest atomic unit of running [&hellip;]","og_url":"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/","og_site_name":"The Couchbase Blog","article_published_time":"2017-01-04T19:18:52+00:00","article_modified_time":"2023-06-21T13:23:31+00:00","og_image":[{"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/01\/kubernetes-pv-couchbase-amazon-web-console-1024x682.png","type":"","width":"","height":""}],"author":"Arun Gupta, VP, Developer Advocacy, Couchbase","twitter_card":"summary_large_image","twitter_creator":"@arungupta","twitter_misc":{"Written by":"Arun Gupta, VP, Developer Advocacy, Couchbase","Est. reading time":"13 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/"},"author":{"name":"Arun Gupta, VP, Developer Advocacy, Couchbase","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/39d8caed0f536489b6aa6e8d31ee631f"},"headline":"Stateful Containers on Kubernetes using Persistent Volume and Amazon EBS","datePublished":"2017-01-04T19:18:52+00:00","dateModified":"2023-06-21T13:23:31+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/"},"wordCount":1061,"commentCount":2,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","articleSection":["Couchbase Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/","url":"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/","name":"Stateful Containers on Kubernetes using Persistent Volume and Amazon EBS - The Couchbase Blog","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","datePublished":"2017-01-04T19:18:52+00:00","dateModified":"2023-06-21T13:23:31+00:00","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2022\/11\/couchbase-nosql-dbaas.png","width":1800,"height":630},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/stateful-containers-kubernetes-amazon-ebs\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Stateful Containers on Kubernetes using Persistent Volume and Amazon EBS"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"The Couchbase Blog","description":"Couchbase, the NoSQL Database","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"The Couchbase Blog","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/39d8caed0f536489b6aa6e8d31ee631f","name":"Arun Gupta, VP, Developer Advocacy, Couchbase","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/image\/8900a75409c646948fe0bd80f6240337","url":"https:\/\/secure.gravatar.com\/avatar\/f912e10b5f39748ee4f1a0b0da6f42747f0b3a94fe7acb511791468656f5e726?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/f912e10b5f39748ee4f1a0b0da6f42747f0b3a94fe7acb511791468656f5e726?s=96&d=mm&r=g","caption":"Arun Gupta, VP, Developer Advocacy, Couchbase"},"description":"Arun Gupta is the vice president of developer advocacy at Couchbase. He has built and led developer communities for 10+ years at Sun, Oracle, and Red Hat. He has deep expertise in leading cross-functional teams to develop and execute strategy, planning and execution of content, marketing campaigns, and programs. Prior to that he led engineering teams at Sun and is a founding member of the Java EE team. Gupta has authored more than 2,000 blog posts on technology. He has extensive speaking experience in more than 40 countries on myriad topics and is a JavaOne Rock Star for three years in a row. Gupta also founded the Devoxx4Kids chapter in the US and continues to promote technology education among children. An author of several books on technology, an avid runner, a globe trotter, a Java Champion, a JUG leader, NetBeans Dream Team member, and a Docker Captain, he is easily accessible at @arungupta.","sameAs":["https:\/\/x.com\/arungupta"],"url":"https:\/\/www.couchbase.com\/blog\/author\/arun-gupta\/"}]}},"authors":[{"term_id":8933,"user_id":58,"is_guest":0,"slug":"arun-gupta","display_name":"Arun Gupta, VP, Developer Advocacy, Couchbase","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/f912e10b5f39748ee4f1a0b0da6f42747f0b3a94fe7acb511791468656f5e726?s=96&d=mm&r=g","author_category":"","last_name":"Gupta","first_name":"Arun","job_title":"","user_url":"","description":"Arun Gupta is the vice president of developer advocacy at Couchbase. He has built and led developer communities for 10+ years at Sun, Oracle, and Red Hat. He has deep expertise in leading cross-functional teams to develop and execute strategy, planning and execution of content, marketing campaigns, and programs. Prior to that he led engineering teams at Sun and is a founding member of the Java EE team.\r\n\r\nGupta has authored more than 2,000 blog posts on technology. He has extensive speaking experience in more than 40 countries on myriad topics and is a JavaOne Rock Star for three years in a row. Gupta also founded the Devoxx4Kids chapter in the US and continues to promote technology education among children. An author of several books on technology, an avid runner, a globe trotter, a Java Champion, a JUG leader, NetBeans Dream Team member, and a Docker Captain, he is easily accessible at @arungupta."}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/2360","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/users\/58"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/comments?post=2360"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/posts\/2360\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media\/13873"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/media?parent=2360"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/categories?post=2360"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/tags?post=2360"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/wp-json\/wp\/v2\/ppma_author?post=2360"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}