{"id":1986,"date":"2023-11-08T03:57:03","date_gmt":"2023-11-08T03:57:03","guid":{"rendered":"https:\/\/feellikelearning.com\/?p=1986"},"modified":"2023-11-08T03:57:04","modified_gmt":"2023-11-08T03:57:04","slug":"run-tidb-using-kubernates-microk8s-on-ubuntu","status":"publish","type":"post","link":"https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/","title":{"rendered":"\u5728Ubuntu\u4e0a\u4f7f\u7528Kubernates (microk8s)\u8dd1TiDB"},"content":{"rendered":"\n<p>\u5148\u5efa\u7acb\u4e00\u4e2anamespace\uff0c\u5c31\u53ebtidb<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">kubectl create namespace tidb\n<\/pre>\n\n\n\n<p>\u5efa\u7acb\u4e00\u4e2atidb\u7684yaml\u6587\u4ef6\uff0c\u53ebtidb.yaml<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"yaml\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">apiVersion: apps\/v1\nkind: Deployment\nmetadata:\n  name: tidb-deployment\n  namespace: tidb\nspec:\n  replicas: 1\n  selector:\n    matchLabels:\n      app: tidb\n  template:\n    metadata:\n      labels:\n        app: tidb\n    spec:\n      containers:\n      - name: tidb\n        image: pingcap\/tidb:latest\n        ports:\n        - containerPort: 4000\n\n---\napiVersion: v1\nkind: Service\nmetadata:\n  name: tidb-service\n  namespace: tidb\nspec:\n  selector:\n    app: tidb\n  ports:\n  - protocol: TCP\n    port: 4000\n    targetPort: 4000<\/pre>\n\n\n\n<p>\u7528kubernates\u542f\u52a8tidb<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">microk8s.kubectl apply -f tidb3.yaml<\/pre>\n\n\n\n<p>\u67e5\u770b\u72b6\u6001\u53ef\u4ee5\u7528\u4ee5\u4e0b\u547d\u4ee4<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">microk8s.kubectl get deployments -n tidb\nmicrok8s.kubectl get pods -n tidb\nmicrok8s.kubectl logs -n tidb &lt;pod-name from above>\nmicrok8s.kubectl get services -n tidb<\/pre>\n\n\n\n<p>\u5b89\u88c5mysql\u5ba2\u6237\u7aef\uff0c\u5982\u679c\u4e4b\u524d\u6ca1\u6709\u5b89\u88c5\u7684\u8bdd<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">sudo apt install mysql-client-core-8.0<\/pre>\n\n\n\n<p>\u8fde\u63a5tidb<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">mysql -h CLUSTER-IP -P PORT -u root -p<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>\u5148\u5efa\u7acb\u4e00\u4e2anamespace\uff0c\u5c31\u53ebtidb \u5efa\u7acb\u4e00\u4e2atidb\u7684yaml\u6587\u4ef6\uff0c\u53ebtidb.yaml \u7528kubernates\u542f\u52a8tidb \u67e5\u770b\u72b6\u6001\u53ef\u4ee5\u7528\u4ee5\u4e0b\u547d\u4ee4 \u5b89\u88c5mysql\u5ba2\u6237\u7aef\uff0c\u5982\u679c\u4e4b\u524d\u6ca1\u6709\u5b89\u88c5\u7684\u8bdd \u8fde\u63a5tidb<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false},"categories":[1],"tags":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v19.10 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u5728Ubuntu\u4e0a\u4f7f\u7528Kubernates (microk8s)\u8dd1TiDB | Feel Like Learning<\/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:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5728Ubuntu\u4e0a\u4f7f\u7528Kubernates (microk8s)\u8dd1TiDB | Feel Like Learning\" \/>\n<meta property=\"og:description\" content=\"\u5148\u5efa\u7acb\u4e00\u4e2anamespace\uff0c\u5c31\u53ebtidb \u5efa\u7acb\u4e00\u4e2atidb\u7684yaml\u6587\u4ef6\uff0c\u53ebtidb.yaml \u7528kubernates\u542f\u52a8tidb \u67e5\u770b\u72b6\u6001\u53ef\u4ee5\u7528\u4ee5\u4e0b\u547d\u4ee4 \u5b89\u88c5mysql\u5ba2\u6237\u7aef\uff0c\u5982\u679c\u4e4b\u524d\u6ca1\u6709\u5b89\u88c5\u7684\u8bdd \u8fde\u63a5tidb\" \/>\n<meta property=\"og:url\" content=\"https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/\" \/>\n<meta property=\"og:site_name\" content=\"Feel Like Learning\" \/>\n<meta property=\"article:published_time\" content=\"2023-11-08T03:57:03+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-11-08T03:57:04+00:00\" \/>\n<meta name=\"author\" content=\"feellikelearning\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"feellikelearning\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/\"},\"author\":{\"name\":\"feellikelearning\",\"@id\":\"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a\"},\"headline\":\"\u5728Ubuntu\u4e0a\u4f7f\u7528Kubernates (microk8s)\u8dd1TiDB\",\"datePublished\":\"2023-11-08T03:57:03+00:00\",\"dateModified\":\"2023-11-08T03:57:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/\"},\"wordCount\":15,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/\",\"url\":\"https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/\",\"name\":\"\u5728Ubuntu\u4e0a\u4f7f\u7528Kubernates (microk8s)\u8dd1TiDB | Feel Like Learning\",\"isPartOf\":{\"@id\":\"https:\/\/feellikelearning.com\/#website\"},\"datePublished\":\"2023-11-08T03:57:03+00:00\",\"dateModified\":\"2023-11-08T03:57:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/feellikelearning.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5728Ubuntu\u4e0a\u4f7f\u7528Kubernates (microk8s)\u8dd1TiDB\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/feellikelearning.com\/#website\",\"url\":\"https:\/\/feellikelearning.com\/\",\"name\":\"Feel Like Learning\",\"description\":\"\u7a0b\u5e8f\uff5c\u751f\u6d3b\uff5c\u5b66\u5230\u5c31\u662f\u8d5a\u5230\",\"publisher\":{\"@id\":\"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/feellikelearning.com\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a\",\"name\":\"feellikelearning\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/feellikelearning.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/72a1e86e9dcb0332e88bd7d54fd36c28?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/72a1e86e9dcb0332e88bd7d54fd36c28?s=96&d=mm&r=g\",\"caption\":\"feellikelearning\"},\"logo\":{\"@id\":\"https:\/\/feellikelearning.com\/#\/schema\/person\/image\/\"},\"url\":\"https:\/\/feellikelearning.com\/index.php\/author\/feellikelearning\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5728Ubuntu\u4e0a\u4f7f\u7528Kubernates (microk8s)\u8dd1TiDB | Feel Like Learning","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:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/","og_locale":"en_US","og_type":"article","og_title":"\u5728Ubuntu\u4e0a\u4f7f\u7528Kubernates (microk8s)\u8dd1TiDB | Feel Like Learning","og_description":"\u5148\u5efa\u7acb\u4e00\u4e2anamespace\uff0c\u5c31\u53ebtidb \u5efa\u7acb\u4e00\u4e2atidb\u7684yaml\u6587\u4ef6\uff0c\u53ebtidb.yaml \u7528kubernates\u542f\u52a8tidb \u67e5\u770b\u72b6\u6001\u53ef\u4ee5\u7528\u4ee5\u4e0b\u547d\u4ee4 \u5b89\u88c5mysql\u5ba2\u6237\u7aef\uff0c\u5982\u679c\u4e4b\u524d\u6ca1\u6709\u5b89\u88c5\u7684\u8bdd \u8fde\u63a5tidb","og_url":"https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/","og_site_name":"Feel Like Learning","article_published_time":"2023-11-08T03:57:03+00:00","article_modified_time":"2023-11-08T03:57:04+00:00","author":"feellikelearning","twitter_card":"summary_large_image","twitter_misc":{"Written by":"feellikelearning","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/#article","isPartOf":{"@id":"https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/"},"author":{"name":"feellikelearning","@id":"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a"},"headline":"\u5728Ubuntu\u4e0a\u4f7f\u7528Kubernates (microk8s)\u8dd1TiDB","datePublished":"2023-11-08T03:57:03+00:00","dateModified":"2023-11-08T03:57:04+00:00","mainEntityOfPage":{"@id":"https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/"},"wordCount":15,"commentCount":0,"publisher":{"@id":"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a"},"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/","url":"https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/","name":"\u5728Ubuntu\u4e0a\u4f7f\u7528Kubernates (microk8s)\u8dd1TiDB | Feel Like Learning","isPartOf":{"@id":"https:\/\/feellikelearning.com\/#website"},"datePublished":"2023-11-08T03:57:03+00:00","dateModified":"2023-11-08T03:57:04+00:00","breadcrumb":{"@id":"https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/feellikelearning.com\/index.php\/2023\/11\/08\/run-tidb-using-kubernates-microk8s-on-ubuntu\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/feellikelearning.com\/"},{"@type":"ListItem","position":2,"name":"\u5728Ubuntu\u4e0a\u4f7f\u7528Kubernates (microk8s)\u8dd1TiDB"}]},{"@type":"WebSite","@id":"https:\/\/feellikelearning.com\/#website","url":"https:\/\/feellikelearning.com\/","name":"Feel Like Learning","description":"\u7a0b\u5e8f\uff5c\u751f\u6d3b\uff5c\u5b66\u5230\u5c31\u662f\u8d5a\u5230","publisher":{"@id":"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/feellikelearning.com\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/feellikelearning.com\/#\/schema\/person\/91fb815bebebf166c217b5e3764d437a","name":"feellikelearning","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/feellikelearning.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/72a1e86e9dcb0332e88bd7d54fd36c28?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/72a1e86e9dcb0332e88bd7d54fd36c28?s=96&d=mm&r=g","caption":"feellikelearning"},"logo":{"@id":"https:\/\/feellikelearning.com\/#\/schema\/person\/image\/"},"url":"https:\/\/feellikelearning.com\/index.php\/author\/feellikelearning\/"}]}},"_links":{"self":[{"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/posts\/1986"}],"collection":[{"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/comments?post=1986"}],"version-history":[{"count":5,"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/posts\/1986\/revisions"}],"predecessor-version":[{"id":1991,"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/posts\/1986\/revisions\/1991"}],"wp:attachment":[{"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/media?parent=1986"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/categories?post=1986"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/feellikelearning.com\/index.php\/wp-json\/wp\/v2\/tags?post=1986"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}