1(self.webpackChunklitmus_docs2_0=self.webpackChunklitmus_docs2_0||[]).push([[17804],{3905:function(e,t,n){"use strict";n.d(t,{Zo:function(){return u},kt:function(){return d}});var a=n(67294);function s(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,a)}return n}function o(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function i(e,t){if(null==e)return{};var n,a,s=function(e,t){if(null==e)return{};var n,a,s={},r=Object.keys(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||(s[n]=e[n]);return s}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(a=0;a<r.length;a++)n=r[a],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(s[n]=e[n])}return s}var l=a.createContext({}),c=function(e){var t=a.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):o(o({},t),e)),n},u=function(e){var t=c(e.components);return a.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return a.createElement(a.Fragment,{},t)}},m=a.forwardRef((function(e,t){var n=e.components,s=e.mdxType,r=e.originalType,l=e.parentName,u=i(e,["components","mdxType","originalType","parentName"]),m=c(n),d=s,h=m["".concat(l,".").concat(d)]||m[d]||p[d]||r;return n?a.createElement(h,o(o({ref:t},u),{},{components:n})):a.createElement(h,o({ref:t},u))}));function d(e,t){var n=arguments,s=t&&t.mdxType;if("string"==typeof e||s){var r=n.length,o=new Array(r);o[0]=m;var i={};for(var l in t)hasOwnProperty.call(t,l)&&(i[l]=t[l]);i.originalType=e,i.mdxType="string"==typeof e?e:s,o[1]=i;for(var c=2;c<r;c++)o[c]=n[c];return a.createElement.apply(null,o)}return a.createElement.apply(null,n)}m.displayName="MDXCreateElement"},90692:function(e,t,n){"use strict";n.r(t),n.d(t,{frontMatter:function(){return i},contentTitle:function(){return l},metadata:function(){return c},toc:function(){return u},default:function(){return m}});var a=n(22122),s=n(19756),r=(n(67294),n(3905)),o=["components"],i={id:"chaoscenter-namespace-scope-installation",title:"ChaosCenter Namespace Scope Installation",sidebar_label:"Namespace Scope"},l=void 0,c={unversionedId:"user-guides/chaoscenter-namespace-scope-installation",id:"version-2.3.0/user-guides/chaoscenter-namespace-scope-installation",isDocsHomePage:!1,title:"ChaosCenter Namespace Scope Installation",description:"---",source:"@site/versioned_docs/version-2.3.0/user-guides/chaoscenter-namespace-scope-installation.md",sourceDirName:"user-guides",slug:"/user-guides/chaoscenter-namespace-scope-installation",permalink:"/docs/2.3.0/user-guides/chaoscenter-namespace-scope-installation",editUrl:"https://github.com/litmuschaos/litmus-docs/edit/master/website/versioned_docs/version-2.3.0/user-guides/chaoscenter-namespace-scope-installation.md",version:"2.3.0",lastUpdatedAt:1640655989,formattedLastUpdatedAt:"12/28/2021",frontMatter:{id:"chaoscenter-namespace-scope-installation",title:"ChaosCenter Namespace Scope Installation",sidebar_label:"Namespace Scope"},sidebar:"version-2.3.0/docs",previous:{title:"Cluster Scope",permalink:"/docs/2.3.0/user-guides/chaoscenter-cluster-scope-installation"},next:{title:"Setup without Ingress",permalink:"/docs/2.3.0/user-guides/setup-without-ingress"}},u=[{value:"Prerequisites",id:"prerequisites",children:[]},{value:"Installation",id:"installation",children:[{value:"<strong>Install Litmus using Helm </strong>",id:"install-litmus-using-helm",children:[]},{value:"<strong>Install Litmus using kubectl </strong>",id:"install-litmus-using-kubectl",children:[]}]},{value:"<strong>Verify your installation</strong>",id:"verify-your-installation",children:[]},{value:"Resources",id:"resources",children:[]},{value:"Learn more",id:"learn-more",children:[]}],p={toc:u};function m(e){var t=e.components,n=(0,s.Z)(e,o);return(0,r.kt)("wrapper",(0,a.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("hr",null),(0,r.kt)("h2",{id:"prerequisites"},"Prerequisites"),(0,r.kt)("p",null,"Before deploying LitmusChaos, make sure the following items are there"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Kubernetes 1.17 or later")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"A Persistent volume of 20GB"),(0,r.kt)("div",{parentName:"li",className:"admonition admonition-note alert alert--secondary"},(0,r.kt)("div",{parentName:"div",className:"admonition-heading"},(0,r.kt)("h5",{parentName:"div"},(0,r.kt)("span",{parentName:"h5",className:"admonition-icon"}
1,(0,r.kt)("svg",{parentName:"span",xmlns:"http://www.w3.org/2000/svg",width:"14",height:"16",viewBox:"0 0 14 16"},(0,r.kt)("path",{parentName:"svg",fillRule:"evenodd",d:"M6.3 5.69a.942.942 0 0 1-.28-.7c0-.28.09-.52.28-.7.19-.18.42-.28.7-.28.28 0 .52.09.7.28.18.19.28.42.28.7 0 .28-.09.52-.28.7a1 1 0 0 1-.7.3c-.28 0-.52-.11-.7-.3zM8 7.99c-.02-.25-.11-.48-.31-.69-.2-.19-.42-.3-.69-.31H6c-.27.02-.48.13-.69.31-.2.2-.3.44-.31.69h1v3c.02.27.11.5.31.69.2.2.42.31.69.31h1c.27 0 .48-.11.69-.31.2-.19.3-.42.31-.69H8V7.98v.01zM7 2.3c-3.14 0-5.7 2.54-5.7 5.68 0 3.14 2.56 5.7 5.7 5.7s5.7-2.55 5.7-5.7c0-3.15-2.56-5.69-5.7-5.69v.01zM7 .98c3.86 0 7 3.14 7 7s-3.14 7-7 7-7-3.12-7-7 3.14-7 7-7z"}))),"note")),(0,r.kt)("div",{parentName:"div",className:"admonition-content"},(0,r.kt)("p",{parentName:"div"},"Recommend to have a Persistent volume(PV) of 20GB, You can start with 1GB for test purposes as well. This PV is used as persistent storage to store the chaos config and chaos-metrics in the Portal. By default, litmus install would use the default storage class to allocate the PV. Provide this value")))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},(0,r.kt)("a",{parentName:"p",href:"https://v3.helm.sh/"},"Helm3")," or ",(0,r.kt)("a",{parentName:"p",href:"https://kubernetes.io/docs/tasks/tools/#kubectl"},"kubectl")))),(0,r.kt)("h2",{id:"installation"},"Installation"),(0,r.kt)("p",null,"Installation of Litmus can be done using either of the below methods"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#install-litmus-using-helm"},"Helm3")," chart"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"#install-litmus-using-kubectl"},"Kubectl")," yaml spec file")),(0,r.kt)("h3",{id:"install-litmus-using-helm"},(0,r.kt)("strong",{parentName:"h3"},"Install Litmus using Helm ")),(0,r.kt)("p",null,"The helm chart will install all the required service account configuration and ChaosCenter."),(0,r.kt)("p",null,"The following steps will help you install Litmus ChaosCenter via helm."),(0,r.kt)("h4",{id:"step-1-add-the-litmus-helm-repository"},"Step-1: Add the litmus helm repository"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"helm repo add litmuschaos https://litmuschaos.github.io/litmus-helm/\nhelm repo list\n")),(0,r.kt)("h4",{id:"step-2-create-the-namespace-on-which-you-want-to-install-litmus-chaoscenter-required-only-if-namespace-isnt-there"},"Step-2: Create the namespace on which you want to install Litmus ChaosCenter ",(0,r.kt)("span",{style:{color:"#909191"}},(0,r.kt)("b",null,"[Required only if namespace isn't there]"))),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},'The chaoscenter components can be placed in any namespace, though it is typically placed in "litmus".')),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl create ns litmus\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"The ChaosCenter can be placed in any namespace, though it is typically placed in ",(0,r.kt)("inlineCode",{parentName:"p"},"litmus"),". Ignore if you already have the namespace where you want to install Litmus created.")),(0,r.kt)("h4",{id:"step-3-install-the-required-litmus-crds"},"Step-3: Install the required Litmus CRDs"),(0,r.kt)("p",null,"The cluster-admin or an equivalent user with the right permissions are required to install the CRDs upfront."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl apply -f https://raw.githubusercontent.com/litmuschaos/litmus/master/litmus-portal/litmus-portal-crds.yml\n")),(0,r.kt)("span",{style:{color:"green"}},(0,r.kt)("b",null,"Expected Output")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"customresourcedefinition.apiextensions.k8s.io/clusterworkflowtemplates.argoproj.io created\ncustomresourcedefinition.apiextensions.k8s.io/cronworkflows.argoproj.io created\ncustomresourcedefinition.apiextensions.k8s.io/workflows.argoproj.io created\ncustomresourcedefinition.apiextensions.k8s.io/workflowtemplates.argoproj.io created\ncustomresourcedefinition.apiextensions.k8s.io/chaosengines.litmuschaos.io created\ncustomresourcedefinition.apiextensions.k8s.io/chaosexperiments.litmuschaos.io created\ncustomresourcedefinition.apiextensions.k8s.io/chaosresults.litmuschaos.io created\ncustomresourcedefinition.apiextensions.k8s.io/eventtrackerpolicies.eventtracker.litmuschaos.io created\n")),(0,r.kt)("h4",{id:"step-4-install-litmus-chaoscenter"},"Step-4: Install Litmus ChaosCenter"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"helm install chaos litmuschaos/litmus --namespace=litmus --set portalScope=namespace\n")),(0,r.kt)("span",{style:{color:"green"}},(0,r.kt)("b",null,"Expected Output")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"NAME: chaos\nLAST DEPLOYED: Tue Jun 15 19:20:09 2021\nNAMESPACE: litmus\nSTATUS: deployed\nREVISION: 1\nTEST SUITE: None\nNOTES:\nThank you for installing litmus \ud83d\ude00\n\nYour release is named chaos and its installed to namespace: litmus.\n\nVisit https://docs.litmuschaos.io/ to find more info.\n\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},(0,r.kt)("strong",{parentName:"p"},"Note:")," Litmus uses Kubernetes CRDs to define chaos intent. Helm3 handles CRDs better than Helm2. Before you start running a chaos experiment, verify if Litmus is installed correctly.")),(0,r.kt)("h3",{id:"install-litmus-using-kubectl"},(0,r.kt)("strong",{parentName:"h3"},"Install Litmus using kubectl ")),(0,r.kt)("h4",{id:"set-the-namespace-on-which-you-want-to-install-litmus-chaoscenter"},(0,r.kt)("strong",{parentName:"h4"},"Set the namespace on which you want to install Litmus ChaosCenter")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'export LITMUS_PORTAL_NAMESPACE="<namespace>"\nkubectl get ns ${LITMUS_PORTAL_NAMESPACE}\n')),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"If the namespace is not already present then create the target namespace ",(0,r.kt)("inlineCode",{parentName:"p"},"kubectl create ns ${LITMUS_PORTAL_NAMESPACE}")," or ",(0,r.kt)("inlineCode",{parentName:"p"},"kubectl create ns <Your Namespace>"))),(0,r.kt)("span",{style:{color:"green"}},(0,r.kt)("b",null,"Expected Output")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"NAME STATUS AGE\nlitmus Active 79m\n")),(0,r.kt)("h4",{id:"install-the-required-litmus-crds"},(0,r.kt)("strong",{parentName:"h4"},"Install the required Litmus CRDs")),(0,r.kt)("p",null,"The cluster-admin or an equivalent user with the right permissions are required to install the CRDs upfront."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl apply -f https://raw.githubusercontent.com/litmuschaos/litmus/master/litmus-portal/litmus-portal-crds.yml\n")),(0,r.kt)("span",{style:{color:"green"}},(0,r.kt)("b",null,"Expected Output")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"customresourcedefinition.apiextensions.k8s.io/clusterworkflowtemplates.argoproj.io created\ncustomresourcedefinition.apiextensions.k8s.io/cronworkflows.argoproj.io created\ncustomresourcedefinition.apiextensions.k8s.io/workflows.argoproj.io created\ncustomresourcedefinition.apiextensions.k8s.io/workflowtemplates.argoproj.io created\ncustomresourcedefinition.apiextensions.k8s.io/chaosengines.litmuschaos.io created\ncustomresourcedefinition.apiextensions.k8s.io/chaosexperiments.litmuschaos.io created\ncustomresourcedefinition.apiextensions.k8s.io/chaosresults.litmuschaos.io created\ncustomresourcedefinition.apiextensions.k8s.io/eventtrackerpolicies.eventtracker.litmuschaos.io created\n")),(0,r.kt)("h4",{id:"install-litmus-chaoscenter"},(0,r.kt)("strong",{parentName:"h4"},"Install Litmus ChaosCenter")),(0,r.kt)("p",null,"Applying the manifest file will install all the required service account configuration and ChaosCenter."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"curl https://raw.githubusercontent.com/litmuschaos/litmus/master/mkdocs/docs/2.3.0/litmus-namespaced-2.3.0.yaml --output litmus-portal-namespaced-K8s-template.yml\nenvsubst '${LITMUS_PORTAL_NAMESPACE}' < litmus-portal-namespaced-k8s-template.yml > ${LITMUS_PORTAL_NAMESPACE}-ns-scoped-litmus-portal-manifest.yml\nkubectl apply -f ${LITMUS_PORTAL_NAMESPACE}-ns-scoped-litmus-portal-manifest.yml -n ${LITMUS_PORTAL_NAMESPACE}\n")),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"You need to export the namespace in order for the above step to work ",(0,r.kt)("inlineCode",{parentName:"p"},'export LITMUS_PORTAL_NAMESPACE="<namespace>"'),". Ignore if already done in the first step.")),(0,r.kt)("span",{style:{color:"green"}},(0,r.kt)("b",null,"Expected Output")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"configmap/litmus-portal-admin-config created\ndeployment.apps/litmusportal-frontend created\nservice/litmusportal-frontend-service created\nserviceaccount/litmus-server-account created\nrole.rbac.authorization.k8s.io/litmus-server created\nrolebinding.rbac.authorization.k8s.io/litmus-server-rb created\ndeployment.apps/litmusportal-server created\nservice/litmusportal-server-service created\nstatefulset.apps/mongo created\nservice/mongo-service created\n")),(0,r.kt)("h2",{id:"verify-your-installation"},(0,r.kt)("strong",{parentName:"h2"},"Verify your installation")),(0,r.kt)("hr",null),(0,r.kt)("h4",{id:"verify-if-the-frontend-server-and-database-pods-are-running"},(0,r.kt)("strong",{parentName:"h4"},"Verify if the frontend, server, and database pods are running")),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Check the pods in the namespace where you installed Litmus:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get pods -n litmus\n")),(0,r.kt)("span",{style:{color:"green"}},(0,r.kt)("b",null,"Expected Output")),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"NAME READY STATUS RESTARTS AGE\nlitmusportal-frontend-97c8bf86b-mx89w 1/1 Running 2 6m24s\nlitmusportal-server-5cfbfc88cc-m6c5j 2/2 Running 2 6m19s\nmongo-0 1/1 Running 0 6m16s\n"))),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("p",{parentName:"li"},"Check the services running in the namespace where you installed Litmus:"),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get svc -n litmus\n")),(0,r.kt)("span",{style:{color:"green"}},(0,r.kt)("b",null,"Expected Output")),(0,r.kt)("pre",{parentName:"li"},(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE\nlitmusportal-frontend-service NodePort 10.100.105.154 <none> 9091:30229/TCP 7m14s\nlitmusportal-server-service NodePort 10.100.150.175 <none> 9002:30479/TCP,9003:31949/TCP 7m8s\nmongo-service ClusterIP 10.100.226.179 <none> 27017/TCP 7m6s\n")))),(0,r.kt)("blockquote",null,(0,r.kt)("p",{parentName:"blockquote"},"Note: With the namespace mode of the control panel, we need to set the endpoint of the chaos center server according to the use case. By default, it is ",(0,r.kt)("inlineCode",{parentName:"p"},"http://litmusportal-server-service:9002"))),(0,r.kt)("p",null,"To alter, Apply:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},'kubectl set env deployment/litmusportal-server -n litmus --containers="graphql-server" PORTAL_ENDPOINT="http://172.132.44.44:3231"\n')),(0,r.kt)("hr",null),(0,r.kt)("h4",{id:"verify-successful-registration-of-the-self-agent-post-account-configuration"},(0,r.kt)("strong",{parentName:"h4"},"Verify Successful Registration of the Self Agent post ",(0,r.kt)("a",{parentName:"strong",href:"setup-without-ingress"},"Account Configuration"))),(0,r.kt)("p",null,"Once the project is created, the cluster is automatically registered as a chaos target via installation of ",(0,r.kt)("a",{parentName:"p",href:"/docs/2.3.0/getting-started/resources#chaosagents"},"ChaosAgents"),". This is represented as ",(0,r.kt)("a",{parentName:"p",href:"/docs/2.3.0/getting-started/resources#types-of-chaosagents"},"Self-Agent")," in ",(0,r.kt)("a",{parentName:"p",href:"/docs/2.3.0/getting-started/resources#chaosagents"},"ChaosCenter"),"."),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"kubectl get pods -n litmus\n")),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre",className:"language-bash"},"NAME READY STATUS RESTARTS AGE\nchaos-exporter-547b59d887-4dm58 1/1 Running 0 5m27s\nchaos-operator-ce-84ddc8f5d7-l8c6d 1/1 Running 0 5m27s\nevent-tracker-5bc478cbd7-xlflb 1/1 Running 0 5m28s\nlitmusportal-frontend-97c8bf86b-mx89w 1/1 Running 0 15m\nlitmusportal-server-5cfbfc88cc-m6c5j 2/2 Running 1 15m\nmongo-0 1/1 Running 0 15m\nsubscriber-958948965-qbx29 1/1 Running 0 5m30s\nworkflow-controller-78fc7b6c6-w82m7 1/1 Running 0 5m32s\n")),(0,r.kt)("h2",{id:"resources"},"Resources"),(0,r.kt)("iframe",{width:"560",height:"315",src:"https://www.youtube.com/embed/rOrKegj5ePI",frameborder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture",allowfullscreen:!0}),(0,r.kt)("h2",{id:"learn-more"},"Learn more"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/2.3.0/user-guides/chaoscenter-cluster-scope-installation"},"Install ChaosCenter in Cluster Scope")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/2.3.0/user-guides/setup-without-ingress"},"Setup Endpoints and Access ChaosCenter without Ingress")),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"/docs/2.3.0/user-guides/setup-with-ingress"},"Setup Endpoints and Access ChaosCenter with Ingress"))))}m.isMDXComponent=!0}}]);
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.