<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: API for External Kubernetes Cluster Creation in HPE Morpheus Enterprise</title>
    <link>https://community.hpe.com/t5/hpe-morpheus-enterprise/api-for-external-kubernetes-cluster-creation/m-p/7249773#M2947</link>
    <description>&lt;P&gt;That error does seem like an issue with the kubeconfig format. Let me get back to you with an example payload to use with morpheus command --payload.&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jul 2023 12:06:34 GMT</pubDate>
    <dc:creator>dgaharwar</dc:creator>
    <dc:date>2023-07-11T12:06:34Z</dc:date>
    <item>
      <title>API for External Kubernetes Cluster Creation</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise/api-for-external-kubernetes-cluster-creation/m-p/7249772#M2946</link>
      <description>&lt;P&gt;Hello Experts,&lt;/P&gt;
&lt;P&gt;I am looking you advices how can I create &lt;STRONG&gt;external Kubernetes cluster&lt;/STRONG&gt; with &lt;STRONG&gt;API URL, Token and kubeconfig&lt;/STRONG&gt; as same capability of GUI mode.&lt;/P&gt;
&lt;P&gt;I tried using Cluster API ( &lt;A href="https://apidocs.morpheusdata.com/v6.0.1/reference/addcluster" rel="noopener nofollow ugc"&gt;https://apidocs.morpheusdata.com/v6.0.1/reference/addcluster&lt;/A&gt; ) it doesn’t have options to pass those values. So, I firstly created the cluster with external Kubernetes layout Id and default service plan first. And then I tired to update this cluster with additional parameters by using update cluster API ( &lt;A href="https://apidocs.morpheusdata.com/v6.0.1/reference/updatecluster" rel="noopener nofollow ugc"&gt;https://apidocs.morpheusdata.com/v6.0.1/reference/updatecluster&lt;/A&gt; ). However, it gives me error messages and doesn’t allow to put serviceUrl and serviceToken.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;&lt;DIV class="lightbox-wrapper"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="image"&gt;&lt;img src="https://community.hpe.com/t5/image/serverpage/image-id/149902iA447CCE3D9CAEE24/image-size/large?v=v2&amp;amp;px=2000" role="button" title="45159f0d920cc28a2a44fbe51f0bebe932a72b70.png" alt="45159f0d920cc28a2a44fbe51f0bebe932a72b70.png" /&gt;&lt;/span&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;
&lt;P&gt;{“errors”:{“serviceUrl”:“Update for field not allowed or unrecognized”&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;
Aung&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jul 2023 10:14:28 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise/api-for-external-kubernetes-cluster-creation/m-p/7249772#M2946</guid>
      <dc:creator>AungKT</dc:creator>
      <dc:date>2023-07-09T10:14:28Z</dc:date>
    </item>
    <item>
      <title>Re: API for External Kubernetes Cluster Creation</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise/api-for-external-kubernetes-cluster-creation/m-p/7249773#M2947</link>
      <description>&lt;P&gt;That error does seem like an issue with the kubeconfig format. Let me get back to you with an example payload to use with morpheus command --payload.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2023 12:06:34 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise/api-for-external-kubernetes-cluster-creation/m-p/7249773#M2947</guid>
      <dc:creator>dgaharwar</dc:creator>
      <dc:date>2023-07-11T12:06:34Z</dc:date>
    </item>
    <item>
      <title>Re: API for External Kubernetes Cluster Creation</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise/api-for-external-kubernetes-cluster-creation/m-p/7249774#M2948</link>
      <description>&lt;ASIDE class="quote group-Certified-Engineer quote-modified" data-username="dgaharwar" data-post="2" data-topic="1271"&gt;
dgaharwar:
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;A href="https://clidocs.morpheusdata.com/en/latest/CLI-Manual.html?highlight=cluster#clusters-add" class="inline-onebox" rel="noopener nofollow ugc"&gt;Getting Started — Morpheus CLI Docs documentation&lt;/A&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;/ASIDE&gt;
&lt;P&gt;Thank you &lt;A class="mention" href="https://community.hpe.com/u/dgaharwar"&gt;@dgaharwar&lt;/A&gt; … I will try it.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jul 2023 02:50:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise/api-for-external-kubernetes-cluster-creation/m-p/7249774#M2948</guid>
      <dc:creator>AungKT</dc:creator>
      <dc:date>2023-07-10T02:50:11Z</dc:date>
    </item>
    <item>
      <title>Re: API for External Kubernetes Cluster Creation</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise/api-for-external-kubernetes-cluster-creation/m-p/7249775#M2949</link>
      <description>&lt;P&gt;Hi Aung,&lt;/P&gt;
&lt;P&gt;Below is an example of the API payload that you can use to create an External Kubernetes Cluster.&lt;/P&gt;
&lt;PRE style="background : #f0f1f2;"&gt;&lt;CODE class="lang-auto"&gt;CURL COMMAND
curl -XPOST "https://&amp;lt;your_appliance_url&amp;gt;/api/clusters" \
  -H "Authorization: Bearer &amp;lt;api_access_token&amp;gt;" \
  -H "Content-Type: application/json" \
  -d '{
  "cluster": {
    "type": "external-kubernetes-cluster",
    "group": {
      "id": 1
    },
    "name": "dgeks02",
    "cloud": {
      "id": 1
    },
    "layout": {
      "id": 162
    },
    "server": {
      "config": {
        "apiUrl": "&amp;lt;api_url&amp;gt;",
        "apiToken": "&amp;lt;api_token&amp;gt;",
        "serviceAccess": "&amp;lt;kube_config&amp;gt;",
        "createUser": true
      },
      "name": "dgeks02",
      "plan": {
        "id": 99,
        "code": "external-default",
        "options": {
        }
      },
      "securityGroups": [

      ],
      "visibility": "private",
      "networkDomain": null,
      "hostname": "dgeks02"
    }
  }
}'
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;A new line should be appended for every line in the &lt;CODE style="background : #f0f1f2;"&gt;kube_config&lt;/CODE&gt;, like this,&lt;/P&gt;
&lt;PRE style="background : #f0f1f2;"&gt;&lt;CODE class="lang-auto"&gt;"apiVersion: v1 \nclusters: \n- cluster: \n    certificate-authority-data: \nLS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUMvakNDQWVhZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJek1EY3dPdk5xOXpaSkw1NXdPQTBlN0JQeHZHZDRZT0EKUFlVPQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==\n    server: &lt;A href="https://A764AAB27ADDA33CE4ABC4FAA7973E90.gr7.us-east-1.eks.amazonaws.com" target="_blank"&gt;https://A764AAB27ADDA33CE4ABC4FAA7973E90.gr7.us-east-1.eks.amazonaws.com&lt;/A&gt; \n  name: dgeks01 \ncontexts: \n- context: \n    cluster: dgeks01 \n    user: dgeks01 \n  name: dgeks01 \ncurrent-context: dgeks01 \nkind: Config \npreferences: {} \nusers: \n- name: dgeks01 \n  user: \n    token: \neyJhbGciOiJSUzI1NiIsImtpZCI6IlJQSGRQaVNkb0YtRGxCd1NEeDZLMXJDUFk2NE1CZU8xZkR4U25RPL6joLXuoAQ82uRCIuMkqdopdbTuXYXWtmFuKPgjaluCUEUod2_ohbo49HC5JoHAJ9ZykwhBjiqIX_x2Y70RpbHEWxsANmzC057L41M4HwoBp3aapNBBVSWA1moEbFOIdzM9wn13eyx8A7UdGVNQ7q6WPbrz6klp8D9W5mHf-FnG_0pJDj-JPnPNtJ5EA"
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;In my example I have used the 1.22 layout hence the &lt;CODE style="background : #f0f1f2;"&gt;layout.id&lt;/CODE&gt; is 162. Here is the list of ids.&lt;/P&gt;
&lt;H1&gt;&lt;A name="layout-options-1" class="anchor" href="#layout-options-1"&gt;&lt;/A&gt;Layout Options&lt;/H1&gt;
&lt;BLOCKQUOTE&gt;
&lt;UL&gt;
&lt;LI&gt;External Kubernetes 1.26 [227]&lt;/LI&gt;
&lt;LI&gt;External Kubernetes 1.25 [226]&lt;/LI&gt;
&lt;LI&gt;External Kubernetes 1.24 [225]&lt;/LI&gt;
&lt;LI&gt;External Kubernetes 1.23 [163]&lt;/LI&gt;
&lt;LI&gt;External Kubernetes 1.22 [162]&lt;/LI&gt;
&lt;LI&gt;External Kubernetes 1.21 [161]&lt;/LI&gt;
&lt;LI&gt;External Kubernetes 1.20 [160]&lt;/LI&gt;
&lt;/UL&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You will also need to replace the &lt;CODE style="background : #f0f1f2;"&gt;plan.id&lt;/CODE&gt; with the &lt;CODE style="background : #f0f1f2;"&gt;Default External&lt;/CODE&gt; plan id in your environment.&lt;/P&gt;
&lt;P&gt;You can also use the Morpheus CLI to generate the API payload.&lt;BR /&gt;
&lt;A href="https://clidocs.morpheusdata.com/en/latest/CLI-Manual.html?highlight=cluster#clusters-add" class="onebox" target="_blank" rel="noopener"&gt;https://clidocs.morpheusdata.com/en/latest/CLI-Manual.html?highlight=cluster#clusters-add&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Thanks&lt;BR /&gt;
Deepti&lt;/P&gt;</description>
      <pubDate>Sun, 09 Jul 2023 22:26:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise/api-for-external-kubernetes-cluster-creation/m-p/7249775#M2949</guid>
      <dc:creator>dgaharwar</dc:creator>
      <dc:date>2023-07-09T22:26:40Z</dc:date>
    </item>
    <item>
      <title>Re: API for External Kubernetes Cluster Creation</title>
      <link>https://community.hpe.com/t5/hpe-morpheus-enterprise/api-for-external-kubernetes-cluster-creation/m-p/7249776#M2950</link>
      <description>&lt;P&gt;Hello &lt;A class="mention" href="https://community.hpe.com/u/dgaharwar"&gt;@dgaharwar&lt;/A&gt; Deepti,&lt;/P&gt;
&lt;P&gt;As per your guidance, I can add external kubernetes cluster via API and also see objects . However, when I try kubectl get command in Cluster &amp;gt; Control section of Morpheus portal, it shows error messages as below. And I also can’t create namespace via portal. Is it kubeconfig format issue when I created via API.  Do you also have sample yaml file for external Kubernetes cluster integration using morpheus command --payload.&lt;/P&gt;
&lt;P&gt;error: error loading config file “/var/opt/morpheus/morpheus-ui/workspace/kubernetes/runtime/fb0634fd-abdf-4f49-a619-5cad713322ca/config”: yaml: mapping values are not allowed in this context.&lt;/P&gt;
&lt;P&gt;Thanks for you help.&lt;/P&gt;
&lt;P&gt;Regards,&lt;BR /&gt;
Aung&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jul 2023 08:15:25 GMT</pubDate>
      <guid>https://community.hpe.com/t5/hpe-morpheus-enterprise/api-for-external-kubernetes-cluster-creation/m-p/7249776#M2950</guid>
      <dc:creator>AungKT</dc:creator>
      <dc:date>2023-07-11T08:15:25Z</dc:date>
    </item>
  </channel>
</rss>

