{"id":508086,"date":"2022-11-09T04:48:35","date_gmt":"2022-11-09T01:48:35","guid":{"rendered":"https:\/\/en.buradabiliyorum.com\/how-to-run-mysql-on-kubernetes-with-oracles-operator\/"},"modified":"2022-11-09T04:48:35","modified_gmt":"2022-11-09T01:48:35","slug":"how-to-run-mysql-on-kubernetes-with-oracles-operator","status":"publish","type":"post","link":"https:\/\/buradabiliyorum.com\/en\/how-to-run-mysql-on-kubernetes-with-oracles-operator\/","title":{"rendered":"#How to Run MySQL on Kubernetes With Oracle\u2019s Operator"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_90 counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6b05d5c29156f\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #dd3333;color:#dd3333\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #dd3333;color:#dd3333\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6b05d5c29156f\" checked aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-run-mysql-on-kubernetes-with-oracles-operator\/#%E2%80%9CHow_to_Run_MySQL_on_Kubernetes_With_Oracles_Operator%E2%80%9D\" >&#8220;How to Run MySQL on Kubernetes With Oracle\u2019s Operator&#8221;<\/a><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-run-mysql-on-kubernetes-with-oracles-operator\/#What_Is_The_MySQL_Operator\" >What Is The MySQL Operator?<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-run-mysql-on-kubernetes-with-oracles-operator\/#Installing_the_MySQL_Operator\" >Installing the MySQL Operator<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-run-mysql-on-kubernetes-with-oracles-operator\/#Creating_a_Root_User_Credentials_Secret\" >Creating a Root User Credentials Secret<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-run-mysql-on-kubernetes-with-oracles-operator\/#Creating_a_Basic_Cluster\" >Creating a Basic Cluster<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-run-mysql-on-kubernetes-with-oracles-operator\/#Connecting_to_Your_Cluster\" >Connecting to Your Cluster<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-run-mysql-on-kubernetes-with-oracles-operator\/#Accessing_Your_Database_Externally\" >Accessing Your Database Externally<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-run-mysql-on-kubernetes-with-oracles-operator\/#Customizing_MySQL_Server_Settings\" >Customizing MySQL Server Settings<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-run-mysql-on-kubernetes-with-oracles-operator\/#Setting_the_Storage_Capacity\" >Setting the Storage Capacity<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-run-mysql-on-kubernetes-with-oracles-operator\/#Pinning_the_MySQL_Version\" >Pinning the MySQL Version<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/buradabiliyorum.com\/en\/how-to-run-mysql-on-kubernetes-with-oracles-operator\/#Summary\" >Summary<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"%E2%80%9CHow_to_Run_MySQL_on_Kubernetes_With_Oracles_Operator%E2%80%9D\"><\/span>&#8220;How to Run MySQL on Kubernetes With Oracle\u2019s Operator&#8221;<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<div>\n<img loading=\"lazy\" decoding=\"async\" class=\"type:primaryImage alignnone size-full wp-image-817757\" data-pagespeed-no-defer=\"\" src=\"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/07\/MySQL.jpg?width=1198&amp;trim=1,1&amp;bg-color=000&amp;pad=1,1\" alt=\"Graphic showing the MySQL logo\" width=\"1202\" height=\"677\"\/><\/p>\n<p>Kubernetes support for stateful <a href=\"https:\/\/buradabiliyorum.com\/en\/category\/download-scripts-themes-apps\/\" data-internallinksmanager029f6b8e52c=\"9\" title=\"Download Scripts &amp; Themes &amp; Apps\" target=\"_blank\" rel=\"noopener\">app<\/a>lications has considerably matured over the past few years. Now it\u2019s viable to locate your database inside your cluster, allowing it to benefit from the same scalability as your other workloads.<\/p>\n<p>MySQL is one of the most popular relational database engines and it\u2019s now augmented by an official Kubernetes operator. The Oracle-led <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/github.com\/mysql\/mysql-operator\">open-source project<\/a> provides a simple way to create managed MySQL clusters within Kubernetes.<\/p>\n<p>In this article, you\u2019ll learn how to install the operator and get started provisioning a database. The operator automatically creates services so applications in your other containers can connect to MySQL.<\/p>\n<h2 id=\"what-is-the-mysql-operator\"><span class=\"ez-toc-section\" id=\"What_Is_The_MySQL_Operator\"><\/span>What Is The MySQL Operator?<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Oracle\u2019s MySQL operator is a component that runs inside your cluster to automate database initialization. You don\u2019t need the operator to use MySQL in Kubernetes \u2013 you could deploy the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/hub.docker.com\/_\/mysql\">official container image<\/a> yourself by using a StatefulSet. This approach is cumbersome though, requiring you to author and maintain long manifest files to create a reliable environment.<\/p>\n<p>The <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/dev.mysql.com\/doc\/mysql-operator\/en\/mysql-operator-introduction.html\">operator provides<\/a> a set of custom resources that you can use to create your databases. Adding an <code>InnoDBCluster<\/code> object to your Kubernetes cluster prompts the operator to set up StatefulSets, storage, and networking for you. It also automates upgrades and backups, greatly reducing the burden on administrators.<\/p>\n<h2 id=\"installing-the-mysql-operator\"><span class=\"ez-toc-section\" id=\"Installing_the_MySQL_Operator\"><\/span>Installing the MySQL Operator<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The included <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/github.com\/mysql\/mysql-operator\">Helm<\/a> chart is the simplest way to install the operator in your cluster. Manifest files <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/github.com\/mysql\/mysql-operator\">are available<\/a> as an alternative if you don\u2019t have Helm in your environment.<\/p>\n<p>First add the operator to your Helm repository list:<\/p>\n<pre>$ helm repo add mysql-operator https:\/\/mysql.github.io\/mysql-operator\/<\/pre>\n<p>Next update Helm\u2019s repository database so it discovers the available charts:<\/p>\n<pre>$ helm repo update<\/pre>\n<p>Now use the following command to install the operator into a new namespace called <code>mysql-operator<\/code>:<\/p>\n<pre>$ helm install mysql-operator mysql-operator\/mysql-operator \\&#13;\n    --namespace mysql-operator \\&#13;\n    --create-namespace&#13;\nNAME: mysql-operator&#13;\nLAST DEPLOYED: Sat Oct 29 15:00:26 2022&#13;\nNAMESPACE: mysql-operator&#13;\nSTATUS: deployed&#13;\nREVISION: 1&#13;\nTEST SUITE: None<\/pre>\n<p>It might take a few seconds for the process to complete.<\/p>\n<h2 id=\"creating-a-root-user-credentials-secret\"><span class=\"ez-toc-section\" id=\"Creating_a_Root_User_Credentials_Secret\"><\/span>Creating a Root User Credentials Secret<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Each database cluster you create must be accompanied by a Kubernetes secret that contains the credentials for the MySQL root user. The operator will create the root-privileged account with the username and password provided in the secret.<\/p>\n<p>Copy the following YAML manifest and change the value of the <code>rootPassword<\/code> field to something secure. Alter the username and <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/dev.mysql.com\/doc\/refman\/5.7\/en\/account-names.html\">user host settings<\/a> too if applicable to your situation. Remember that the account named here will have total control over MySQL; you should set up separate users for your applications later on, using the regular MySQL shell.<\/p>\n<div class=\"wp-geshi-highlight-wrap5\">\n<div class=\"wp-geshi-highlight-wrap4\">\n<div class=\"wp-geshi-highlight-wrap3\">\n<div class=\"wp-geshi-highlight-wrap2\">\n<div class=\"wp-geshi-highlight-wrap\">\n<div class=\"wp-geshi-highlight\">\n<div class=\"yaml\">\n<pre class=\"de1\"><strong class=\"co3\">apiVersion<\/strong><strong class=\"sy2\">: <\/strong>v1<strong class=\"co3\">\nkind<\/strong><strong class=\"sy2\">: <\/strong>Secret<strong class=\"co4\">\nmetadata<\/strong>:<strong class=\"co3\">\n  name<\/strong><strong class=\"sy2\">: <\/strong>mysql-root-user<strong class=\"co4\">\nstringData<\/strong>:<strong class=\"co3\">\n  rootHost<\/strong><strong class=\"sy2\">: <\/strong><strong class=\"st0\">\"%\"<\/strong><strong class=\"co3\">\n  rootUser<\/strong><strong class=\"sy2\">: <\/strong><strong class=\"st0\">\"root\"<\/strong><strong class=\"co3\">\n  rootPassword<\/strong><strong class=\"sy2\">: <\/strong><strong class=\"st0\">\"P@$$w0rd\"<\/strong><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>Save the file as <code>secret.yaml<\/code>. Now use Kubectl to add the secret to your cluster:<\/p>\n<pre>$ kubectl apply -f secret.yaml&#13;\nsecret\/mysql-root-user created<\/pre>\n<h2 id=\"creating-a-basic-cluster\"><span class=\"ez-toc-section\" id=\"Creating_a_Basic_Cluster\"><\/span>Creating a Basic Cluster<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Next create a new YAML file called <code>mysql.yaml<\/code> and copy the following content:<\/p>\n<div class=\"wp-geshi-highlight-wrap5\">\n<div class=\"wp-geshi-highlight-wrap4\">\n<div class=\"wp-geshi-highlight-wrap3\">\n<div class=\"wp-geshi-highlight-wrap2\">\n<div class=\"wp-geshi-highlight-wrap\">\n<div class=\"wp-geshi-highlight\">\n<div class=\"yaml\">\n<pre class=\"de1\"><strong class=\"co3\">apiVersion<\/strong><strong class=\"sy2\">: <\/strong>mysql.oracle.com\/v2<strong class=\"co3\">\nkind<\/strong><strong class=\"sy2\">: <\/strong>InnoDBCluster<strong class=\"co4\">\nmetadata<\/strong>:<strong class=\"co3\">\n  name<\/strong><strong class=\"sy2\">: <\/strong>mysql-cluster<strong class=\"co4\">\nspec<\/strong>:<strong class=\"co3\">\n  secretName<\/strong><strong class=\"sy2\">: <\/strong>mysql-root-user<strong class=\"co3\">\n  instances<\/strong><strong class=\"sy2\">: <\/strong>3<strong class=\"co3\">\n  tlsUseSelfSigned<\/strong><strong class=\"sy2\">: <\/strong>true<strong class=\"co4\">\n  router<\/strong>:<strong class=\"co3\">\n    instances<\/strong><strong class=\"sy2\">: <\/strong>1<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>This defines an object using the <code>InnoDBCluster<\/code> custom resource offered by the MySQL operator. Applying the manifest to your cluster will create a new MySQL database with replication automatically configured. Review and change the following properties in the manifest before you continue:<\/p>\n<ul>\n<li><strong><code>spec.secretName<\/code><\/strong> \u2013 This must match the <code>metadata.name<\/code> of the secret you created earlier. The referenced secret will be read to set up the MySQL root user account.<\/li>\n<li><strong><code>spec.instances<\/code><\/strong> \u2013 This defines how many MySQL replicas (Pods) to run. Up to 10 replicas are currently supported.<\/li>\n<li><strong><code>spec.tlsUseSelfSigned<\/code><\/strong> \u2013 The field is set to <code>true<\/code> in this example to use the included self-signed TLS certificate. You can optionally supply your own certificate via a Kubernetes secret by setting the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/dev.mysql.com\/doc\/mysql-operator\/en\/mysql-operator-properties.html#mysql-operator-spec-innodbclusterspec\"><code>spec.tlsSecretName<\/code>\/<code>spec.tlsCASecretName<\/code> fields<\/a>.<\/li>\n<li><strong><code>spec.router.instances<\/code><\/strong> \u2013 The MySQL Router component is responsible for directing service traffic between the available MySQL replicas. This field defines how many instances of the router to run. Multiple instances will improve performance and resiliency in high-traffic situations.<\/li>\n<\/ul>\n<p>Use Kubectl to apply the manifest and create your database cluster:<\/p>\n<pre>$ kubectl apply -f mysql.yaml&#13;\ninnodbcluster.mysql.oracle.com\/mysql-cluster created<\/pre>\n<p>The MySQL initialization process can take a couple of minutes to complete. The operator uses several init containers to set up user accounts and configure MySQL\u2019s data directory. Wait a few moments before running <code>kubectl get pods<\/code> to check what\u2019s running:<\/p>\n<pre>$ kubectl get pods&#13;\nNAME                                    READY   STATUS    RESTARTS   AGE&#13;\nmysql-cluster-0                         2\/2     Running   0          2m&#13;\nmysql-cluster-1                         2\/2     Running   0          2m&#13;\nmysql-cluster-2                         2\/2     Running   0          2m&#13;\nmysql-cluster-router-6b68f9b5cb-wbqm5   1\/1     Running   0          2m<\/pre>\n<p>The three MySQL replicas and single router instance are all in the <code>Running<\/code> state. The database is now ready to use.<\/p>\n<h2 id=\"connecting-to-your-cluster\"><span class=\"ez-toc-section\" id=\"Connecting_to_Your_Cluster\"><\/span>Connecting to Your Cluster<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The MySQL operator creates a Kubernetes service that routes traffic from your application Pods to your database. The service gets assigned a hostname with the following format:<\/p>\n<pre>&lt;cluster-name&gt;.&lt;namespace-name&gt;.svc.cluster.local<\/pre>\n<p>The correct hostname for the example cluster shown above is <code>mysql-cluster.default.svc.cluster.local<\/code>. Configure your applications to connect to MySQL at this address using port 3306 and the user credentials you defined in your secret.<\/p>\n<h3 id=\"accessing-your-database-externally\"><span class=\"ez-toc-section\" id=\"Accessing_Your_Database_Externally\"><\/span>Accessing Your Database Externally<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>You can access MySQL from outside your cluster using Kubectl\u2019s port forwarding capabilities. Run the following command to open a new port forwarding session:<\/p>\n<pre>$ kubectl port-forward service\/mysql-cluster 3306<\/pre>\n<p>Replace <code>mysql-cluster<\/code> with the name of the <code>InnoDBCluster<\/code> you want to connect to. Now you can use your local tools to interact with your database:<\/p>\n<pre>$ mysql -h127.0.0.1 -u root -p<\/pre>\n<p>Pressing Ctrl+C in the terminal window running the <code>kubectl port-forward<\/code> command will close the connection.<\/p>\n<h2 id=\"customizing-mysql-server-settings\"><span class=\"ez-toc-section\" id=\"Customizing_MySQL_Server_Settings\"><\/span>Customizing MySQL Server Settings<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>You can supply any <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/option-files.html\">MySQL config file<\/a> options that your application requires by setting the <code>spec.mycnf<\/code> field in your <code>InnoDBCluster<\/code> object\u2019s manifest:<\/p>\n<div class=\"wp-geshi-highlight-wrap5\">\n<div class=\"wp-geshi-highlight-wrap4\">\n<div class=\"wp-geshi-highlight-wrap3\">\n<div class=\"wp-geshi-highlight-wrap2\">\n<div class=\"wp-geshi-highlight-wrap\">\n<div class=\"wp-geshi-highlight\">\n<div class=\"yaml\">\n<pre class=\"de1\"><strong class=\"co3\">apiVersion<\/strong><strong class=\"sy2\">: <\/strong>mysql.oracle.com\/v2<strong class=\"co3\">\nkind<\/strong><strong class=\"sy2\">: <\/strong>InnoDBCluster<strong class=\"co4\">\nspec<\/strong><strong class=\"sy2\">:\n<\/strong>  <strong class=\"co1\"># ...<\/strong><strong class=\"co3\">\n  mycnf<\/strong><strong class=\"sy2\">: |\n<\/strong><strong class=\"co0\">    [mysqld]\n    max_connections=500\n    innodb_ft_min_token_size=5<\/strong><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>The operator will use the value of this field to write the <code>my.cnf<\/code> file in the filesystem of your database Pods.<\/p>\n<h2 id=\"setting-the-storage-capacity\"><span class=\"ez-toc-section\" id=\"Setting_the_Storage_Capacity\"><\/span>Setting the Storage Capacity<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The operator automatically creates a Persistent Volume (PV) and Persistent Volume Claim (PVC) to store your database\u2019s data. It defaults to providing 2Gi of storage.<\/p>\n<p>This can be changed using the <code>datadirVolumeClaimTemplate<\/code> manifest field which allows you to override properties of the PVC resource produced by the operator. Set the <code>resources.requests.storage<\/code> property to the capacity you require.<\/p>\n<div class=\"wp-geshi-highlight-wrap5\">\n<div class=\"wp-geshi-highlight-wrap4\">\n<div class=\"wp-geshi-highlight-wrap3\">\n<div class=\"wp-geshi-highlight-wrap2\">\n<div class=\"wp-geshi-highlight-wrap\">\n<div class=\"wp-geshi-highlight\">\n<div class=\"yaml\">\n<pre class=\"de1\"><strong class=\"co3\">apiVersion<\/strong><strong class=\"sy2\">: <\/strong>mysql.oracle.com\/v2<strong class=\"co3\">\nkind<\/strong><strong class=\"sy2\">: <\/strong>InnoDBCluster<strong class=\"co4\">\nspec<\/strong><strong class=\"sy2\">:\n<\/strong>  <strong class=\"co1\"># ...<\/strong><strong class=\"co4\">\n  datadirVolumeClaimTemplate<\/strong>:<strong class=\"co4\">\n    resources<\/strong>:<strong class=\"co4\">\n      requests<\/strong>:<strong class=\"co3\">\n        storage<\/strong><strong class=\"sy2\">: <\/strong>10Gi<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p>You should set this high enough that there\u2019s plenty of room for your data to grow in the future. The operator doesn\u2019t support in-place volume resizes so you\u2019ll see an error if you try to increase the capacity in the future. Switching to a bigger volume would necessitate manual migration steps.<\/p>\n<h2 id=\"pinning-the-mysql-version\"><span class=\"ez-toc-section\" id=\"Pinning_the_MySQL_Version\"><\/span>Pinning the MySQL Version<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>You can pin to a specific MySQL release with the <code>spec.version<\/code> and <code>spec.router.version<\/code> fields. This will prevent unintentional automatic upgrades. Select the same version for your MySQL Pods and router instances to guarantee compatibility.<\/p>\n<div class=\"wp-geshi-highlight-wrap5\">\n<div class=\"wp-geshi-highlight-wrap4\">\n<div class=\"wp-geshi-highlight-wrap3\">\n<div class=\"wp-geshi-highlight-wrap2\">\n<div class=\"wp-geshi-highlight-wrap\">\n<div class=\"wp-geshi-highlight\">\n<div class=\"yaml\">\n<pre class=\"de1\"><strong class=\"co3\">apiVersion<\/strong><strong class=\"sy2\">: <\/strong>mysql.oracle.com\/v2<strong class=\"co3\">\nkind<\/strong><strong class=\"sy2\">: <\/strong>InnoDBCluster<strong class=\"co4\">\nspec<\/strong><strong class=\"sy2\">:\n<\/strong>  <strong class=\"co1\"># ...<\/strong><strong class=\"co3\">\n  version<\/strong><strong class=\"sy2\">: <\/strong>8.0.31<strong class=\"co4\">\n  router<\/strong>:<strong class=\"co3\">\n    instances<\/strong><strong class=\"sy2\">: <\/strong>1<strong class=\"co3\">\n    version<\/strong><strong class=\"sy2\">: <\/strong>8.0.31<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<h2 id=\"summary\"><span class=\"ez-toc-section\" id=\"Summary\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>Oracle\u2019s MySQL Operator provides a convenient mechanism for running MySQL databases within a Kubernetes cluster. You can provision new replicated databases by creating <code>InnoDBCluster<\/code> objects. This is much simpler than manually creating StatefulSets and services that expose regular MySQL containers.<\/p>\n<p>Using the operator doesn\u2019t impede your ability to control MySQL or your Kubernetes environment. You can customize your Pods by supplying your own manifest properties in the <a rel=\"nofollow noopener\" target=\"_blank\" href=\"https:\/\/dev.mysql.com\/doc\/mysql-operator\/en\/mysql-operator-properties.html#mysql-operator-spec-innodbcluster\"><code>spec.podSpec<\/code> field<\/a> and use your own MySQL config file with the steps shown above. The operator also offers integrated backup support, letting you copy your database to external storage on a recurring schedule.<\/p>\n<\/div>\n<p><script>\n setTimeout(function(){\n  !function(f,b,e,v,n,t,s)\n  {if(f.fbq)return;n=f.fbq=function(){n.callMethod?\n  n.callMethod.apply(n,arguments):n.queue.push(arguments)};\n  if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';\n  n.queue=[];t=b.createElement(e);t.async=!0;\n  t.src=v;s=b.getElementsByTagName(e)[0];\n  s.parentNode.insertBefore(t,s) } (window, document,'script',\n  'https:\/\/connect.facebook.net\/en_US\/fbevents.js');\n   fbq('init', '335401813750447');\n   fbq('track', 'PageView');\n  },3000);\n<\/script><\/p>\n<blockquote><p><strong><span style=\"color: #ff6600;\">If you liked the article, do not forget to share it with your friends. Follow us on\u00a0<span style=\"color: #ff0000;\"><a style=\"color: #ff0000;\" href=\"https:\/\/news.google.com\/publications\/CAAqBwgKMLG0nwswvr63Aw\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">Google News<\/a><\/span>\u00a0too, click on the star and choose us from your favorites.<\/span><\/strong><\/p><\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\">For forums sites go to <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/forum.buradabiliyorum.com\/\" target=\"_blank\" rel=\"noopener\">Forum.BuradaBiliyorum.Com<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<blockquote>\n<p style=\"text-align: center;\"><strong>If you want to read more like this article, you can visit our <span style=\"color: #ff9900;\"><a style=\"color: #ff9900;\" href=\"https:\/\/en.buradabiliyorum.com\/technology\/\" target=\"_blank\" rel=\"noopener\">Technology category.<\/a><\/span><\/strong><\/p>\n<\/blockquote>\n<p><span style=\"color: black;\"><a style=\"color: #ff9900;\" href=\"https:\/\/www.howtogeek.com\/devops\/how-to-run-mysql-on-kubernetes-with-oracles-operator\/\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>&#8220;How to Run MySQL on Kubernetes With Oracle\u2019s Operator&#8221; Kubernetes support for stateful applications has considerably matured over the past few years. Now it\u2019s viable to locate your database inside your cluster, allowing it to benefit from the same scalability as your other workloads. MySQL is one of the most popular relational database engines and&#8230;<\/p>\n","protected":false},"author":1,"featured_media":508087,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"fifu_image_url":"https:\/\/www.howtogeek.com\/wp-content\/uploads\/2022\/07\/MySQL.jpg?height=200p&trim=2,2,2,2","fifu_image_alt":"","footnotes":""},"categories":[18],"tags":[],"class_list":["post-508086","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-technology"],"_links":{"self":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/508086","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/comments?post=508086"}],"version-history":[{"count":0,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/posts\/508086\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media\/508087"}],"wp:attachment":[{"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/media?parent=508086"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/categories?post=508086"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/buradabiliyorum.com\/en\/wp-json\/wp\/v2\/tags?post=508086"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}