PageSourceSearch

https://archive-os-3-27.netlify.app/assets/js/147cd724.cf4d8c4b.js

js archive-os-3-27.netlify.app collected 2026-10-03 10:28:38 UTC 8,566 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunktigera_docs=self.webpackChunktigera_docs||[]).push([["1981"],{64546:function(e,t,n){n.r(t),n.d(t,{default:()=>u,frontMatter:()=>a,metadata:()=>s,assets:()=>i,toc:()=>l,contentTitle:()=>c});var s=JSON.parse('{"id":"getting-started/kubernetes/hardway/the-calico-datastore","title":"The Calico datastore","description":"The central datastore for your clusters\' operational and configuration state.","source":"@site/calico_versioned_docs/version-3.27/getting-started/kubernetes/hardway/the-calico-datastore.mdx","sourceDirName":"getting-started/kubernetes/hardway","slug":"/getting-started/kubernetes/hardway/the-calico-datastore","permalink":"/calico/3.27/getting-started/kubernetes/hardway/the-calico-datastore","draft":false,"unlisted":false,"editUrl":"https://github.com/tigera/docs/edit/main/calico_versioned_docs/version-3.27/getting-started/kubernetes/hardway/the-calico-datastore.mdx","tags":[],"version":"3.27","frontMatter":{"description":"The central datastore for your clusters\' operational and configuration state."},"sidebar":"calicoSidebar","previous":{"title":"Stand up Kubernetes","permalink":"/calico/3.27/getting-started/kubernetes/hardway/standing-up-kubernetes"},"next":{"title":"Configure IP pools","permalink":"/calico/3.27/getting-started/kubernetes/hardway/configure-ip-pools"}}'),r=n("85893"),o=n("50065");let a={description:"The central datastore for your clusters' operational and configuration state."},c="The Calico datastore",i={},l=[{value:"Using Kubernetes as the datastore",id:"using-kubernetes-as-the-datastore",level:2},{value:"Custom Resources",id:"custom-resources",level:2},{value:"calicoctl",id:"calicoctl",level:2},{value:"Install",id:"install",level:3},{value:"Test",id:"test",level:3},{value:"Next",id:"next",level:2}];function d(e){let t={a:"a",code:"code",h1:"h1",h2:"h2",h3:"h3",header:"header",li:"li",ol:"ol",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,o.a)(),...e.components};return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(t.header,{children:(0,r.jsx)(t.h1,{id:"the-calico-datastore",children:"The Calico datastore"})}),"\n",(0,r.jsx)(t.p,{children:"Calico stores the data about the operational and configuration state of your cluster in a central datastore. If the datastore is unavailable\nyour Calico network continues operating, but cannot be updated (no new pods can be networked, no policy changes can be applied, etc.)."}),"\n",(0,r.jsx)(t.p,{children:"Calico has two datastore drivers you can choose from"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.strong,{children:"etcd"})," - for direct connection to an etcd cluster"]}),"\n",(0,r.jsxs)(t.li,{children:[(0,r.jsx)(t.strong,{children:"Kubernetes"})," - for connection to a Kubernetes API server"]}),"\n"]}),"\n",(0,r.jsx)(t.h2,{id:"using-kubernetes-as-the-datastore",children:"Using Kubernetes as the datastore"}),"\n",(0,r.jsx)(t.p,{children:"This guide uses the Kubernetes API datastore driver. The advantages of this driver when using Calico on Kubernetes are"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"Doesn't require an extra datastore, so is simpler to manage"}),"\n",(0,r.jsx)(t.li,{children:"You can use Kubernetes RBAC to control access to Calico resources"}),"\n",(0,r.jsx)(t.li,{children:"You can use Kubernetes audit logging to generate audit logs of changes to Calico resources"}),"\n"]}),"\n",(0,r.jsx)(t.p,{children:"For completeness, the advantages of the etcd driver are"}),"\n",(0,r.jsxs)(t.ul,{children:["\n",(0,r.jsx)(t.li,{children:"Allows you to run Calico on non-Kubernetes platforms (e.g. OpenStack)"}),"\n",(0,r.jsx)(t.li,{children:"Allows separation of concerns between Kubernetes and Calico resources, for example allowing you to scale the datastores independently"}),"\n",(0,r.jsx)(t.li,{children:"Allows you to run a Calico cluster that contains more than just a single Kubernetes cluster, for example, bare metal servers with Calico\nhost protection interworking with a Kubernetes cluster; or multiple Kubernetes clusters."}),"\n"]}),"\n",(0,r.jsx)(t.h2,{id:"custom-resources",children:"Custom Resources"}),"\n",(0,r.jsxs)(t.p,{children:["When using the Kubernetes API datastore driver, most Calico resources are stored as ",(0,r.jsx)(t.a,{href:"https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/",children:"Kubernetes custom resources"}),"."]}),"\n",(0,r.jsxs)(t.p,{children:["A few Calico resources are not stored as custom resources and instead are backed by corresponding native Kubernetes resources. For example, ",(0,r.jsx)(t.a,{href:"/calico/3.27/reference/resources/workloadendpoint",children:"workload endpoints"})," are Kubernetes pods."]}),"\n",(0,r.jsx)(t.p,{children:"To use Kubernetes as the Calico datastore, we need to define the custom resources Calico uses."}),"\n",(0,r.jsx)(t.p,{children:"Download and examine the list of Calico custom resource definitions, and open it in a file editor."}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"wget https://raw.githubusercontent.com/projectcalico/calico/v3.27.5/manifests/crds.yaml\n"})}),"\n",(0,r.jsx)(t.p,{children:"Create the custom resource definitions in Kubernetes."}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"kubectl apply -f crds.yaml\n"})}),"\n",(0,r.jsx)(t.h2,{id:"calicoctl",children:"calicoctl"}),"\n",(0,r.jsxs)(t.p,{children:["To interact directly with the Calico datastore, use the ",(0,r.jsx)(t.code,{children:"calicoctl"})," client tool."]}),"\n",(0,r.jsx)(t.h3,{id:"install",children:"Install"}),"\n",(0,r.jsxs)(t.ol,{children:["\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Download the ",(0,r.jsx)(t.code,{children:"calicoctl"})," binary to a Linux host with access to Kubernetes."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"wget -O calicoctl https://github.com/projectcalico/calico/releases/latest/download/calicoctl-linux-amd64\nchmod +x calicoctl\nsudo mv calicoctl /usr/local/bin/\n"})}),"\n"]}),"\n",(0,r.jsxs)(t.li,{children:["\n",(0,r.jsxs)(t.p,{children:["Configure ",(0,r.jsx)(t.code,{children:"calicoctl"})," to access Kubernetes."]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"export KUBECONFIG=/path/to/your/kubeconfig\nexport DATASTORE_TYPE=kubernetes\n"})}),"\n",(0,r.jsxs)(t.p,{children:["On most systems, kubeconfig is located at ",(0,r.jsx)(t.code,{children:"~/.kube/config"}),". You may wish to add the ",(0,r.jsx)(t.code,{children:"export"})," lines to your ",(0,r.jsx)(t.code,{children:"~/.bashrc"})," so they will persist when you log in next time."]}),"\n"]}),"\n"]}),"\n",(0,r.jsx)(t.h3,{id:"test",children:"Test"}),"\n",(0,r.jsxs)(t.p,{children:["Verify ",(0,r.jsx)(t.code,{children:"calicoctl"})," can reach your datastore by running"]}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"calicoctl get nodes\n"})}),"\n",(0,r.jsx)(t.p,{children:"You should see output similar to"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"NAME\nip-172-31-37-123\nip-172-31-40-217\nip-172-31-40-30\nip-172-31-42-47\nip-172-31-45-29\n"})}),"\n",(0,r.jsxs)(t.p,{children:["Nodes are backed by the Kubernetes node object, so you should see names that match ",(0,r.jsx)(t.code,{children:"kubectl get nodes"}),"."]}),"\n",(0,r.jsx)(t.p,{children:"Try to get an object backed by a custom resource"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"calicoctl get ippools\n"})}),"\n",(0,r.jsx)(t.p,{children:"You should see an empty result"}),"\n",(0,r.jsx)(t.pre,{children:(0,r.jsx)(t.code,{className:"language-bash",children:"NAME   CIDR   SELECTOR\n\n"})}),"\n",(0,r.jsx)(t.h2,{id:"next",children:"Next"}),"\n",(0,r.jsx)(t.p,{children:(0,r.jsx)(t.a,{href:"/calico/3.27/getting-started/kubernetes/hardway/configure-ip-pools",children:"Configure IP pools"})})]})}function u(e={}){let{wrapper:t}={...(0,o.a)(),...e.components};return t?(0,r.jsx)(t,{...e,children:(0,r.jsx)(d,{...e})}):d(e)}},50065:function(e,t,n){n.d(t,{Z:function(){return c},a:function(){return a}});var s=n(67294);let r={},o=s.createContext(r);function a(e){let t=s.useContext(o);return s.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function c(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(r):e.components||r:a(e.components),s.createElement(o.Provider,{value:t},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.