<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Dean</title>
    <description>The latest articles on DEV Community by Dean (@saintdle).</description>
    <link>https://dev.to/saintdle</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F613969%2F7a9fb56c-d019-4cc5-81c4-35d619eec343.jpeg</url>
      <title>DEV Community: Dean</title>
      <link>https://dev.to/saintdle</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/saintdle"/>
    <language>en</language>
    <item>
      <title>Kubernetes Metric Server – cannot validate certificate because it doesn’t contain any IP SANs</title>
      <dc:creator>Dean</dc:creator>
      <pubDate>Thu, 27 Jul 2023 17:09:32 +0000</pubDate>
      <link>https://dev.to/saintdle/kubernetes-metric-server-cannot-validate-certificate-because-it-doesnt-contain-any-ip-sans-3m8f</link>
      <guid>https://dev.to/saintdle/kubernetes-metric-server-cannot-validate-certificate-because-it-doesnt-contain-any-ip-sans-3m8f</guid>
      <description>&lt;p&gt;&lt;strong&gt;The Issue&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Whilst trying to install the Metric’s server:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://github.com/kubernetes-sigs/metrics-server/releases/latest/download/components.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;so I could use &lt;code&gt;kubectl top node&lt;/code&gt; for it’s metrics on Node resource useage, I found the pods were not loading, and upon inspection found the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;gt; kubectl logs -n kube-system metrics-server-6f6cdbf67d-v6sbf 

I0717 12:19:32.132722 1 server.go:187] "Failed probe" probe="metric-storage-ready" err="no metrics to serve"
E0717 12:19:39.159422 1 scraper.go:140] "Failed to scrape node" err="Get \"https://192.168.49.2:10250/metrics/resource\": x509: cannot validate certificate for 192.168.49.2 because it doesn't contain any IP SANs" node="minikube"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;The Cause&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The issue here was due to the installation of Cert-Manager and setting up some TLS configurations within the CNI and Self-Signed certificates, the metric’s server wasn’t able to validate the authority of the Kubernetes API&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Fix&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;As this is communication within the cluster, I could simply fix this by telling Metric Server container to trust the insecure certificates from the API using the below&lt;br&gt;&lt;br&gt;
&lt;code&gt;kubectl patch&lt;/code&gt; command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl patch deployment metrics-server -n kube-system --type='json' -p='[{"op": "add", "path": "/spec/template/spec/containers/0/args/-", "value": "--kubelet-insecure-tls"}]'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Regards&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/saintdle"&gt;Follow @Saintdle&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://uk.linkedin.com/in/saintdle?trk=profile-badge"&gt;Dean Lewis&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://veducate.co.uk/kubernetes-metric-server-validate-certificate/"&gt;Kubernetes Metric Server – cannot validate certificate because it doesn’t contain any IP SANs&lt;/a&gt; appeared first on &lt;a href="https://veducate.co.uk"&gt;vEducate.co.uk&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>api</category>
      <category>certmanager</category>
      <category>certificate</category>
    </item>
    <item>
      <title>Interview with Daniel Bryant, Ambassador Labs – Kubernetes, PaaS, Err what’s next?</title>
      <dc:creator>Dean</dc:creator>
      <pubDate>Thu, 21 Jul 2022 23:05:12 +0000</pubDate>
      <link>https://dev.to/saintdle/interview-with-daniel-bryant-ambassador-labs-kubernetes-paas-err-whats-next-4314</link>
      <guid>https://dev.to/saintdle/interview-with-daniel-bryant-ambassador-labs-kubernetes-paas-err-whats-next-4314</guid>
      <description>&lt;p&gt;After &lt;a href="https://events.linuxfoundation.org/kubecon-cloudnativecon-europe/"&gt;KubeCon EU 2022&lt;/a&gt;, I had the chance to connect with Daniel Bryant, Head of DevRel at Ambassador Labs, and expand on his extremely popular KubeCon Session further.&lt;/p&gt;

&lt;p&gt;I wanted to take his session, and also give it a platform/infra focus, as this is the background and world I'm from in IT, along with a lot of customer teams I work with, and I assume I'm not alone in this. I think we gave enough coverage of the new cloud native concepts and linking this back to the changing skills of platform admin.&lt;br&gt;
My 25 minute marker soon ran over, and we recorded 47 minutes or so. Rather than cut it back or things out, I decided to release the full interview as two parts, to be enjoyed over some extended coffee breaks (tell your boss to blame me if your late back to work 😉 ).&lt;/p&gt;

&lt;p&gt;Hopefully for those of you whom are interested, you enjoy the recordings!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://veducate.co.uk/interview-daniel-bryant/"&gt;vEducate.co.uk - Interview with Daniel Bryant, Ambassador Labs - Kubernetes, PaaS, Err what's next? with a Platform/Infra point-of-view&lt;/a&gt;&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>cloud</category>
      <category>interview</category>
      <category>community</category>
    </item>
    <item>
      <title>Quick Fix – AWS Console – Current user or role does not have access to Kubernetes objects on this EKS Cluster</title>
      <dc:creator>Dean</dc:creator>
      <pubDate>Tue, 25 Jan 2022 13:30:41 +0000</pubDate>
      <link>https://dev.to/saintdle/quick-fix-aws-console-current-user-or-role-does-not-have-access-to-kubernetes-objects-on-this-eks-cluster-256l</link>
      <guid>https://dev.to/saintdle/quick-fix-aws-console-current-user-or-role-does-not-have-access-to-kubernetes-objects-on-this-eks-cluster-256l</guid>
      <description>&lt;h6&gt;
  
  
  The Issue
&lt;/h6&gt;

&lt;p&gt;Once you’ve deployed an EKS cluster, and try to view this in the AWS Console, you are presenting the following message:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Your current user or role does not have access to Kubernetes objects on this EKS Cluster
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2022/01/AWS-Console-Container-Services-Current-user-or-role-does-not-have-access-to-Kubernetes-objects-on-this-EKS-Cluster.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fOn3prYf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2022/01/AWS-Console-Container-Services-Current-user-or-role-does-not-have-access-to-Kubernetes-objects-on-this-EKS-Cluster.jpg%3Fresize%3D604%252C218%26ssl%3D1" alt="AWS Console - Container Services - Current user or role does not have access to Kubernetes objects on this EKS Cluster" width="604" height="218"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  The Cause
&lt;/h6&gt;

&lt;p&gt;This is because you need to run some additional configuration on your cluster to allow your AWS user IAM to access the cluster.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;AWS EKS Docs – &lt;a href="https://docs.aws.amazon.com/eks/latest/userguide/add-user-role.html"&gt;Enabling IAM user and role access to your cluster&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h6&gt;
  
  
  The Fix
&lt;/h6&gt;

&lt;p&gt;Grab your User ARN from the Identity and Access Management (IAM) page.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2022/01/aws-console-user-IAM-2.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mJSrV-dC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2022/01/aws-console-user-IAM-2.jpg%3Fresize%3D604%252C241%26ssl%3D1" alt="aws console - user IAM" width="604" height="241"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Download this template YAML file for configuring the necessary ClusterRole and ClusterRoleBinding and then apply it to your EKS cluster.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;curl -o eks-console-full-access.yaml https://amazon-eks.s3.us-west-2.amazonaws.com/docs/eks-console-full-access.yaml

kubectl apply -f eks-console-full-access.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/apply-eks-console-full-access-configmap.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MQLUAfci--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/apply-eks-console-full-access-configmap.jpg%3Fresize%3D604%252C88%26ssl%3D1" alt="apply eks console full access configmap" width="604" height="88"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now edit the following configmap:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl edit configmap/aws-auth -n kube-system
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Add in the following under the data tree:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mapUsers: |
  - userarn: arn:aws:iam::3xxxxxxx7:user/dean@veducate.co.uk
    username: admin
    groups:
      - system:masters

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2022/01/apply-eks-console-full-access-edit-configmap.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xPQgLxqt--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2022/01/apply-eks-console-full-access-edit-configmap.jpg%3Fresize%3D604%252C287%26ssl%3D1" alt="apply eks console full access - edit configmap" width="604" height="287"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After a minute or so, once you revisit the EKS Cluster page in the AWS console, you will see all the relevant details.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2022/01/AWS-Console-Container-Services-EKS-cluster-view.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z-BvQZT3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2022/01/AWS-Console-Container-Services-EKS-cluster-view.jpg%3Fresize%3D604%252C200%26ssl%3D1" alt="AWS Console - Container Services - EKS cluster view" width="604" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Regards&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/saintdle"&gt;Follow @Saintdle&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://uk.linkedin.com/in/saintdle?trk=profile-badge"&gt;Dean Lewis&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://veducate.co.uk/aws-console-permission-eks-cluster/"&gt;Quick Fix – AWS Console – Current user or role does not have access to Kubernetes objects on this EKS Cluster&lt;/a&gt; appeared first on &lt;a href="https://veducate.co.uk"&gt;vEducate.co.uk&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>aws</category>
      <category>console</category>
      <category>eks</category>
    </item>
    <item>
      <title>Using the new vSphere Kubernetes Driver Operator with Red Hat OpenShift via Operator Hub</title>
      <dc:creator>Dean</dc:creator>
      <pubDate>Wed, 05 Jan 2022 10:36:03 +0000</pubDate>
      <link>https://dev.to/saintdle/using-the-new-vsphere-kubernetes-driver-operator-with-red-hat-openshift-via-operator-hub-4mln</link>
      <guid>https://dev.to/saintdle/using-the-new-vsphere-kubernetes-driver-operator-with-red-hat-openshift-via-operator-hub-4mln</guid>
      <description>&lt;h5&gt;
  
  
  What is the vSphere Kubernetes Driver Operator (VDO)?
&lt;/h5&gt;

&lt;p&gt;This Kubernetes Operator has been designed and created as part of the &lt;a href="https://blogs.vmware.com/cloud/2019/09/05/ibm-vmware-make-mark-one-kind-joint-innovation-lab/"&gt;VMware and IBM Joint Innovation Labs program&lt;/a&gt;. We also talked about this at &lt;a href="https://www.vmware.com/vmworld/en/video-library/search.html#text=%22MCL3142S%22&amp;amp;year=2021"&gt;VMworld 2021 in a joint session with IBM and Red Hat&lt;/a&gt;. With the aim of simplifying the deployment and lifecycle of VMware Storage and Networking Kubernetes driver plugins on any Kubernetes platform, including Red Hat OpenShift.&lt;/p&gt;

&lt;p&gt;This vSphere Kubernetes Driver Operator (VDO) exposes custom resources to configure the CSI and CNS drivers, and using Go Lang based CLI tool, introduces validation and error checking as well. Making it simple for the Kubernetes Operator to deploy and configure.&lt;/p&gt;

&lt;p&gt;The Kubernetes Operator currently covers the following existing CPI, CSI and CNI drivers, which are separately maintained projects found on GitHub.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/kubernetes/cloud-provider-vsphere"&gt;vSphere Cloud Provider&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/kubernetes-sigs/vsphere-csi-driver"&gt;vSphere CSI Storage Driver&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This operator will remain CNI agnostic, therefore CNI management will not be included, and for example &lt;a href="https://github.com/vmware/antrea-operator-for-kubernetes"&gt;Antrea already has an operator.&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/vmware-tanzu/antrea"&gt;vSphere Antrea CNI Driver&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Below is the high level architecture, you can read a more &lt;a href="https://github.com/vmware-tanzu/vsphere-kubernetes-drivers-operator/blob/main/docs/architecture/vdo-architecture.md"&gt;detailed deep dive here&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/vSphere-Kubernetes-Drivers-Operator-Architecture-Topology.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sr99bQaz--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/vSphere-Kubernetes-Drivers-Operator-Architecture-Topology.png%3Fresize%3D604%252C379%26ssl%3D1" alt="vSphere Kubernetes Drivers Operator - Architecture Topology" width="604" height="379"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Installation Methods
&lt;/h5&gt;

&lt;p&gt;You have two main installation methods, which will also affect the pre-requisites below.&lt;/p&gt;

&lt;p&gt;If using Red Hat OpenShift, you can install the Operator via &lt;a href="https://catalog.redhat.com/software/operators/detail/617828032bfbc00e94ed953b#deploy-instructions"&gt;Operator Hub&lt;/a&gt; as this is a certified Red Hat Operator. You can also configure the CPI and CSI driver installations via the UI as well.&lt;/p&gt;

&lt;p&gt;Alternatively, you can install the manual way and use the vdoctl cli tool, this method would also be your route if using a Vanilla Kubernetes installation.&lt;/p&gt;

&lt;p&gt;This blog post will cover the UI method using Operator Hub.&lt;/p&gt;

&lt;h5&gt;
  
  
  Pre-requisites
&lt;/h5&gt;

&lt;p&gt;Kubernetes and vSphere environment must meet the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;vSphere 6.7U3(or later) is supported for VDO&lt;/li&gt;
&lt;li&gt;Virtual Machine hardware version should be version 15(or later)&lt;/li&gt;
&lt;li&gt;Enable Disk UUID(disk.EnableUUID) on all node vm’s&lt;/li&gt;
&lt;li&gt;K8s master nodes should be able to communicate with vCenter management interface&lt;/li&gt;
&lt;li&gt;Disable Swap(swapoff -a) on all Kubernetes nodes at the Guest Operating System level.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/Enable-Disk-UUID-disk.EnableUUID-on-all-node-vms.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BlEUyjEE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/Enable-Disk-UUID-disk.EnableUUID-on-all-node-vms.png%3Fresize%3D604%252C325%26ssl%3D1" alt="Enable Disk UUID - disk.EnableUUID - on all node vms" width="604" height="325"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you are going to deploy this on a Vanilla Kubernetes instance or want to use the CLI tooling:&lt;/p&gt;

&lt;p&gt;Clone the &lt;a href="https://github.com/vmware-tanzu/vsphere-kubernetes-drivers-operator"&gt;VDO GitHub Repo&lt;/a&gt; or download the files from the &lt;a href="https://github.com/vmware-tanzu/vsphere-kubernetes-drivers-operator/releases"&gt;release page.&lt;/a&gt; This installation method will be covered separately in another blog post.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git clone https://github.com/vmware-tanzu/vsphere-kubernetes-drivers-operator
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install Go, so that we can use the vdoctl command line tool.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://go.dev/doc/install"&gt;https://go.dev/doc/install&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h6&gt;
  
  
  Installing and configuring the vSphere Kubernetes Driver Operator
&lt;/h6&gt;

&lt;h6&gt;
  
  
  Installation via Red Hat Operator Hub UI
&lt;/h6&gt;

&lt;ul&gt;
&lt;li&gt;Create a project to install the Operator into.

&lt;ul&gt;
&lt;li&gt;In this example I have used “vsphere-kubernetes-drivers-operator” and will match the below SecurityContext example&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-create-project-namespace.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--C1UFB9O5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-create-project-namespace.png%3Fresize%3D604%252C176%26ssl%3D1" alt="openshift - create project namespace" width="604" height="176"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Create the Security Context Constraint, so that the Service Account can access the relevant resources.

&lt;ul&gt;
&lt;li&gt;Administration &amp;gt; Custom Resource Definitions &amp;gt; SecurityContextConstraints &amp;gt; Instance &amp;gt; Create&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-create-security-context-constraint-scc.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Gm0nbz1z--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-create-security-context-constraint-scc.png%3Fresize%3D604%252C462%26ssl%3D1" alt="openshift - create security context constraint - scc" width="604" height="462"&gt;&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Example SCC [Source and further details](https://github.com/vmware-tanzu/vsphere-kubernetes-drivers-operator/blob/main/docs/getting-started/getting-started-from-operator-hub.md#pre-requisites)
# Used for CSI 2.3.0 and later, ensure the namespace in bold below matches the one you have created earlier

apiVersion: security.openshift.io/v1
kind: SecurityContextConstraints
metadata:
  name: example
allowPrivilegedContainer: true
allowHostDirVolumePlugin: true
allowHostNetwork: true
allowHostPorts: true
defaultAddCapabilities:
- SYS_ADMIN
runAsUser:
  type: RunAsAny
seLinuxContext:
  type: RunAsAny
fsGroup:
  type: RunAsAny
users:
- system:serviceaccount: **vsphere-kubernetes-drivers-operator** :vdo-controller-manager
- system:serviceaccount:vmware-system-csi:vsphere-csi-node
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-create-security-context-constraint-provide-YAML.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AMRRqhpU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-create-security-context-constraint-provide-YAML.png%3Fresize%3D604%252C542%26ssl%3D1" alt="openshift - create security context constraint - provide YAML" width="604" height="542"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we will install the Operator.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go to OperatorHub and search for “vsphere-kubernetes-driver-operator”&lt;/li&gt;
&lt;li&gt;Click the Operator to install it&lt;/li&gt;
&lt;li&gt;Ensure it is installed to the namespace you have created, where the SCC is linked.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Note: I recommend that you ensure you are installing/running Operator version 0.1.5 or higher. This blog post used 0.1.3 in some of the images. However, a number of enhancements were introduced, and I upgraded to 0.1.5 part way through (see [this section for upgrades](https://veducate.co.uk/vsphere-kubernetes-operator-openshift#Performing_upgrades_of_the_Operator_and_deployed_CPICSI))
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-operatorhub-install-vsphere-kubernetes-driver-operator.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--p2pZs6R7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-operatorhub-install-vsphere-kubernetes-driver-operator.png%3Fresize%3D604%252C424%26ssl%3D1" alt="openshift - operatorhub - install vsphere-kubernetes-driver-operator" width="604" height="424"&gt;&lt;/a&gt; &lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-operatorhub-installing-vsphere-kubernetes-driver-operator.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--wxwY67PJ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-operatorhub-installing-vsphere-kubernetes-driver-operator.png%3Fresize%3D604%252C255%26ssl%3D1" alt="openshift - operatorhub - installing vsphere-kubernetes-driver-operator" width="604" height="255"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once completed, click to view the Operator, and we will continue to configure the drivers.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-operatorhub-installed-vsphere-kubernetes-driver-operator.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--HGbtPzjp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-operatorhub-installed-vsphere-kubernetes-driver-operator.png%3Fresize%3D604%252C262%26ssl%3D1" alt="openshift - operatorhub - installed vsphere-kubernetes-driver-operator" width="604" height="262"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  Configuring the CPI and CSI via the Operator in the OpenShift Cluster UI
&lt;/h6&gt;

&lt;p&gt;You will need the following pieces of information&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;IP address or FQDN of vCenter

&lt;ul&gt;
&lt;li&gt;If using a secure connection to the vCenter, you will need to provide the SSL thumbprint&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Credentials for the vCenter with the &lt;a href="https://docs.vmware.com/en/VMware-vSphere-Container-Storage-Plug-in/2.0/vmware-vsphere-csp-getting-started/GUID-043ACF65-9E0B-475C-A507-BBBE2579AA58.html"&gt;appropriate permissions&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Datacenter(s) Names within the vCenter. This is required by CPI and CSI to manage the cluster&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We now need to create a source secret to hold our credentials for our vCenter.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the OpenShift Cluster UI &amp;gt; Workloads &amp;gt; Secrets&lt;/li&gt;
&lt;li&gt;Ensure you are in the namespace of “kube-system”&lt;/li&gt;
&lt;li&gt;Create &amp;gt; Source Secret&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-Create-Source-Secret-with-vCenter-credentials.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MtaoCz4T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-Create-Source-Secret-with-vCenter-credentials.jpg%3Fresize%3D604%252C221%26ssl%3D1" alt="openshift - Create Source Secret with vCenter credentials" width="604" height="221"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Provide a name for the secret&lt;/li&gt;
&lt;li&gt;Authentication type should be set to “basic”&lt;/li&gt;
&lt;li&gt;Provide the username and password and click create&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-Create-Source-Secret-with-vCenter-credentials-2.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RyZcuJUI--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-Create-Source-Secret-with-vCenter-credentials-2.jpg%3Fresize%3D604%252C590%26ssl%3D1" alt="openshift - Create Source Secret with vCenter credentials 2" width="604" height="590"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Go back to the Installed Operators Page, set the namespace where you installed the operator and select it.&lt;/p&gt;

&lt;p&gt;First we will create the vSphere Cloud Config, which is the connection and credential data for our vCenter.&lt;/p&gt;

&lt;p&gt;Click Create Instance under “VsphereCloudConfig”&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-installed-operators-vsphere-kubernetes-drivers-operator-vspherecloudconfig-create-instance.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AgOXgZM3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-installed-operators-vsphere-kubernetes-drivers-operator-vspherecloudconfig-create-instance.jpg%3Fresize%3D604%252C295%26ssl%3D1" alt="openshift - installed operators - vsphere-kubernetes-drivers-operator - vspherecloudconfig create instance" width="604" height="295"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Provide a name for the configuration and any labels as necessary.&lt;/li&gt;
&lt;li&gt;Credentials – provide the name of the source secret created earlier in the kube-system namespace&lt;/li&gt;
&lt;li&gt;Provide your datacenter names&lt;/li&gt;
&lt;li&gt;Select Insecure configuration if necessary

&lt;ul&gt;
&lt;li&gt;If unticked, you need to provide a thumbprint for the vCenter SSL&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;VC IP – you can provide either IP or FQDN here.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Click create.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vspherecloudconfig-create-instance.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--W51QzuuQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vspherecloudconfig-create-instance.jpg%3Fresize%3D604%252C921%26ssl%3D1" alt="openshift - vspherecloudconfig create instance" width="604" height="921"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vspherecloudconfig-instance-created.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5Toti-Jy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vspherecloudconfig-instance-created.jpg%3Fresize%3D604%252C203%26ssl%3D1" alt="openshift - vspherecloudconfig instance created" width="604" height="203"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will now configure the VDOConfig, which will control which drivers are deployed and the credentials to use.&lt;/p&gt;

&lt;p&gt;Click to create a VDOConfig instance.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-installed-operators-vsphere-kubernetes-drivers-operator-vdoconfig-create-instance.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--mxXNMlkC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-installed-operators-vsphere-kubernetes-drivers-operator-vdoconfig-create-instance.jpg%3Fresize%3D604%252C324%26ssl%3D1" alt="openshift - installed operators - vsphere-kubernetes-drivers-operator - vdoconfig create instance" width="604" height="324"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Provide a name for the configuration and any labels as necessary.&lt;/li&gt;
&lt;li&gt;Then open the Storage Provider heading.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdoconfig-create-instance.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vRajuDOL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdoconfig-create-instance.jpg%3Fresize%3D604%252C566%26ssl%3D1" alt="openshift - vdoconfig create instance" width="604" height="566"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Provide the vSphere Cloud Config instance name we have just created&lt;/li&gt;
&lt;li&gt;Provide the ClusterDistribution Name – for this blog it will of course be OpenShift&lt;/li&gt;
&lt;li&gt;But remember this VDO is available for any vanilla K8s setup&lt;/li&gt;
&lt;li&gt;Provide a custom kubelet path if applicable&lt;/li&gt;
&lt;li&gt;Provide configuration for VSAN File Services volumes access if applicable&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdoconfig-create-instance-storage-provider.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--cTCc3mTB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdoconfig-create-instance-storage-provider.jpg%3Fresize%3D604%252C502%26ssl%3D1" alt="openshift - vdoconfig create instance - storage provider" width="604" height="502"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now open the Cloud Provider configuration. If you have already installed the cloud provider in your environment, you do not need to configure this section. However, the Cloud Provider is a mandatory requirement to be installed when using the vSphere CSI Driver. So, if you don’t have it installed already, install it as part of this configuration.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Provide any topology information if applicable. You can read more about deploying the vSphere CSI and CPI in a &lt;a href="https://docs.vmware.com/en/VMware-vSphere-Container-Storage-Plug-in/2.0/vmware-vsphere-csp-getting-started/GUID-73D106A3-1D8A-4CDC-9762-6CB35A65B0B4.html#GUID-73D106A3-1D8A-4CDC-9762-6CB35A65B0B4"&gt;topology aware mode here&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;Provide the name for the vSphere Cloud Config&lt;/li&gt;
&lt;li&gt;Click Create&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdoconfig-create-instance-cloud-provider.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--U1lHUYow--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdoconfig-create-instance-cloud-provider.jpg%3Fresize%3D604%252C583%26ssl%3D1" alt="openshift - vdoconfig create instance - cloud provider" width="604" height="583"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdoconfig-instance.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--D_ASOM4_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdoconfig-instance.jpg%3Fresize%3D604%252C203%26ssl%3D1" alt="openshift - vdoconfig instance" width="604" height="203"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can monitor the Operator performing its actions by going to the “vdo-controller-manager” pod, and viewing the logs from the “manager” container.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdo-manager-logs.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--RuxStuL6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/openshift-vdo-manager-logs.jpg%3Fresize%3D604%252C312%26ssl%3D1" alt="openshift - vdo manager logs" width="604" height="312"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Below you can see the reconciler has picked up the configuration instances and is now attempting to install the CPI. You can follow the logs for the full status.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-vdo-manager-logs-installing-CPI.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--r1cA9fRC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-vdo-manager-logs-installing-CPI.jpg%3Fresize%3D604%252C343%26ssl%3D1" alt="openshift - vdo manager logs - installing CPI" width="604" height="343"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Another Option is to view the VDOConfig instance in the Operator to see the status.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-vsphere-kubernetes-driver-operator-vdoconfig-instance-yaml.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--8Tr5MjM7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-vsphere-kubernetes-driver-operator-vdoconfig-instance-yaml.jpg%3Fresize%3D544%252C776%26ssl%3D1" alt="openshift - vsphere kubernetes driver operator - vdoconfig instance yaml" width="544" height="776"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Once completed, you can check the status of the Pods for the configured CPI and CSI via the UI in the highlighted projects, kube-system for CPI, vmware-system-csi for CSI.&lt;/p&gt;

&lt;p&gt;Or by running the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# CPI
oc get pods -l k8s-app=vsphere-cloud-controller-manager

# CSI
oc get pods -n vmware-system-csi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h6&gt;
  
  
  &lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-CPI-and-CSI-pods-running.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--4Gzz91Z3--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-CPI-and-CSI-pods-running.jpg%3Fresize%3D604%252C491%26ssl%3D1" alt="openshift - CPI and CSI pods running" width="604" height="491"&gt;&lt;/a&gt;
&lt;/h6&gt;

&lt;h6&gt;
  
  
  Testing and validating the installation
&lt;/h6&gt;

&lt;p&gt;To test the installation, we will configure a StorageClass and then a Persistent Volume Claim.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To go StorageClasses under Storage&lt;/li&gt;
&lt;li&gt;Click Create StorageClass&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-create-storage-class.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SIndppR5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-create-storage-class.jpg%3Fresize%3D604%252C227%26ssl%3D1" alt="openshift - create storage class" width="604" height="227"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Either use the form to fill in, and select the provisioner as “csi.vmware.com” or use the “Edit YAML” view and paste in your configuration such as the below &lt;a href="https://github.com/saintdle/vSphere-CSI-Driver-2.0-OpenShift-4/blob/master/Example-SC%2BPVC/csi-sc-vmc-example.yaml"&gt;example.&lt;/a&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kind: StorageClass
apiVersion: storage.k8s.io/v1
metadata:
  name: csi-sc-vmc
  annotations:
    storageclass.kubernetes.io/is-default-class: "false"
provisioner: csi.vsphere.vmware.com
parameters:
  StoragePolicyName: "vSAN Default Storage Policy"
  datastoreURL: "ds:///vmfs/volumes/vsan:3672d400f5fa4515-8a8cb78f6b972f74/"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-create-storage-class-edit-yaml-example.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--I_jZwdia--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-create-storage-class-edit-yaml-example.jpg%3Fresize%3D604%252C329%26ssl%3D1" alt="openshift - create storage class - edit yaml example" width="604" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To create a Persistent Volume Claim (PVC)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Under Storage navigation heading select PersistentVolumeClaims&lt;/li&gt;
&lt;li&gt;Click Create PersistentVolumeClaim&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-create-persistent-volume-claim.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JKQDxuUr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-create-persistent-volume-claim.jpg%3Fresize%3D604%252C163%26ssl%3D1" alt="openshift - create persistent volume claim" width="604" height="163"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Provide the necessary details, such as selecting your Storage Class and the correct Volume mode. Again you have the ability to use the “Edit YAML” option and provide the configuration such as the below &lt;a href="https://github.com/saintdle/vSphere-CSI-Driver-2.0-OpenShift-4/blob/master/Example-SC%2BPVC/csi-pvc-example.yaml#L1"&gt;example&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kind: PersistentVolumeClaim
apiVersion: v1
metadata:
  name: veducate-blog-test-pvc
  labels:
    name: veducate-blog-test-pvc
  annotations:
    volume.beta.kubernetes.io/storage-class: veducate-csi
spec:
  accessModes:
  - ReadWriteOnce
  resources:
    requests:
      storage: 1Gi

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And we are looking for a status of Bound.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-persistent-volume-claim-status-bound.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--R46Y47xB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-persistent-volume-claim-status-bound.jpg%3Fresize%3D604%252C403%26ssl%3D1" alt="openshift - persistent volume claim - status bound" width="604" height="403"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  Performing upgrades of the Operator and deployed CPI/CSI
&lt;/h6&gt;

&lt;p&gt;The operator will follow the upgrade option you provided during install, either automatically when a new version is released, or manually. You can &lt;a href="https://docs.openshift.com/container-platform/4.9/operators/admin/olm-upgrading-operators.html"&gt;read more about this behaviour&lt;/a&gt; on the Red Hat OpenShift Documentation site.&lt;/p&gt;

&lt;p&gt;The CPI and CSI will be installed and aligned to the compatibility matrix in use. You can check which file is in use by going to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Workloads &amp;gt; Config Maps &amp;gt; Ensure you are in the vSphere Kubernetes Driver Operator namespace &amp;gt; compat-matrix-config&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-vsphere-kubernetes-driver-operator-compability-matrix-configuration.-.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xqXtehP_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2022/01/openshift-vsphere-kubernetes-driver-operator-compability-matrix-configuration.-.jpg%3Fresize%3D604%252C370%26ssl%3D1" alt="openshift - vsphere kubernetes driver operator - compability matrix configuration." width="604" height="370"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Drivers can be updated by updating the compatibility matrix using the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;vdoctl update compatibility-matrix &amp;lt;path-to-updated-compat-matrix&amp;gt;

# Existing pods of CloudProvider and StorageProvider are terminated and new pods are spawned according to the compatible versions of CSI and CPI

# You can either provide your own file, such as one which is edited with the locations of your own modified vSphere CSI deployment files, or a later file from the [GitHub Repo releases page.](https://github.com/vmware-tanzu/vsphere-kubernetes-drivers-operator/releases)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Summary
&lt;/h5&gt;

&lt;p&gt;This new operator does what it sets out to achieve, to simplify the deployment, configuration and lifecycle of the vSphere Kubernetes Drivers. And for the Red Hat OpenShift customers, it’s fully supported and certified.&lt;/p&gt;

&lt;p&gt;The VMware team have made the tooling and ability to consume this new “Master Operator of the Drivers” flexible in terms of consumption, and simple.&lt;/p&gt;

&lt;p&gt;Regards&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/saintdle"&gt;Follow @Saintdle&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://uk.linkedin.com/in/saintdle?trk=profile-badge"&gt;Dean Lewis&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://veducate.co.uk/vsphere-kubernetes-operator-openshift/"&gt;Using the new vSphere Kubernetes Driver Operator with Red Hat OpenShift via Operator Hub&lt;/a&gt; appeared first on &lt;a href="https://veducate.co.uk"&gt;vEducate.co.uk&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>vmware</category>
      <category>csi</category>
      <category>driver</category>
    </item>
    <item>
      <title>Deleting AWS EKS Cluster fails – Cannot evict pod as it would violate the pod’s disruption budget</title>
      <dc:creator>Dean</dc:creator>
      <pubDate>Wed, 22 Dec 2021 11:38:05 +0000</pubDate>
      <link>https://dev.to/saintdle/deleting-aws-eks-cluster-fails-cannot-evict-pod-as-it-would-violate-the-pods-disruption-budget-6ha</link>
      <guid>https://dev.to/saintdle/deleting-aws-eks-cluster-fails-cannot-evict-pod-as-it-would-violate-the-pods-disruption-budget-6ha</guid>
      <description>&lt;h6&gt;
  
  
  The Issue
&lt;/h6&gt;

&lt;p&gt;I had to remove a demo EKS Cluster where I had screwed up an install of a Service Mesh. Unfortunately, it was left in a rather terrible state to clean up, hence the need to just delete it.&lt;/p&gt;

&lt;p&gt;When I tried the usual eksctl delete command, including with the force argument, I was hitting errors such as:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;2021-12-21 23:52:22 [!] pod eviction error ("error evicting pod: istio-system/istiod-76f699dc48-tgc6m: Cannot evict pod as it would violate the pod's disruption budget.") on node ip-192-168-27-182.us-east-2.compute.internal
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With a final error output of:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Error: Unauthorized
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/eksctl-delete-cluster-Cannot-evict-pod-as-it-would-violate-the-pods-disruption-budget-Error-Unauthorized.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--nXPnfTUr--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/eksctl-delete-cluster-Cannot-evict-pod-as-it-would-violate-the-pods-disruption-budget-Error-Unauthorized.png%3Fresize%3D604%252C161%26ssl%3D1" alt="eksctl delete cluster - Cannot evict pod as it would violate the pod's disruption budget - Error Unauthorized" width="604" height="161"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  The Cause
&lt;/h6&gt;

&lt;p&gt;Well, the error message does call out the cause, moving the existing pods to other nodes is failing due to the configured settings. Essentially EKS will try and drain all the nodes and shut everything down nicely when it deletes the cluster. It doesn’t just shut everything down and wipe it. This is because inside of Kubernetes there are several finalizers that will call out actions to interact with AWS components (thanks to the integrations) and nicely clean things up (in theory).&lt;/p&gt;

&lt;p&gt;To get around this, I first tried the following command, thinking if delete the nodegroup without waiting for a drain, this would bypass the issue:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; eksctl delete nodegroup standard --cluster veducate-eks --drain=false --disable-eviction
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This didn’t allow me to delete the cluster however, I still got the same error messages.&lt;/p&gt;

&lt;h6&gt;
  
  
  The Fix
&lt;/h6&gt;

&lt;p&gt;So back to the error message, and then I realised it was staring me in the face!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Cannot evict pod as it would violate the pod's disruption budget
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What is a &lt;a href="https://kubernetes.io/docs/concepts/workloads/pods/disruptions/"&gt;Pod Disruption Budget&lt;/a&gt;? It’s essentially a way to ensure availability of your pods from someone killing them accidentality.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;A PDB limits the number of Pods of a replicated application that are down simultaneously from voluntary disruptions. For example, a quorum-based application would like to ensure that the number of replicas running is never brought below the number needed for a quorum. A web front end might want to ensure that the number of replicas serving load never falls below a certain percentage of the total.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To find all configured Pod Disruption Budgets:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get poddisruptionbudget -A
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then delete as necessary:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl delete poddisruptionbudget {name} -n {namespace}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/eks-kubectl-get-poddisruptionbudgets-A-kubectl-delete-poddisruptionbudgets.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qmg3dxiv--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/eks-kubectl-get-poddisruptionbudgets-A-kubectl-delete-poddisruptionbudgets.png%3Fresize%3D604%252C157%26ssl%3D1" alt="eks - kubectl get poddisruptionbudgets -A - kubectl delete poddisruptionbudgets" width="604" height="157"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, you should be able to delete your cluster.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/eksctl-delete-cluster-successful.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AixrGzUB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/eksctl-delete-cluster-successful.png%3Fresize%3D604%252C159%26ssl%3D1" alt="eksctl delete cluster - successful" width="604" height="159"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Regards&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/saintdle"&gt;Follow @Saintdle&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://uk.linkedin.com/in/saintdle?trk=profile-badge"&gt;Dean Lewis&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://veducate.co.uk/delete-eks-fails-cannot-evict-pod/"&gt;Deleting AWS EKS Cluster fails – Cannot evict pod as it would violate the pod’s disruption budget&lt;/a&gt; appeared first on &lt;a href="https://veducate.co.uk"&gt;vEducate.co.uk&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>deletecluster</category>
      <category>eks</category>
      <category>fails</category>
    </item>
    <item>
      <title>Deploying Nvidia GPU enabled Tanzu Kubernetes Clusters</title>
      <dc:creator>Dean</dc:creator>
      <pubDate>Thu, 09 Dec 2021 23:01:04 +0000</pubDate>
      <link>https://dev.to/saintdle/deploying-nvidia-gpu-enabled-tanzu-kubernetes-clusters-40ma</link>
      <guid>https://dev.to/saintdle/deploying-nvidia-gpu-enabled-tanzu-kubernetes-clusters-40ma</guid>
      <description>&lt;p&gt;In this blog post I’m going to detail how deploy and configure a Nvidia GPU enabled Tanzu Kubernetes Grid cluster in AWS. The method will be similar for Azure, for vSphere there are a number of additional steps to prepare the system. I’m going to essentially follow the official documentation, then run some of the Nvidia tests. Like always, it’s good to get a visual reference and such for these kinds of deployments.&lt;/p&gt;

&lt;h6&gt;
  
  
  Pre-Reqs
&lt;/h6&gt;

&lt;ul&gt;
&lt;li&gt;Nvidia today only &lt;a href="https://docs.nvidia.com/datacenter/cloud-native/gpu-operator/platform-support.html#linux-distributions"&gt;support Ubuntu deployed images&lt;/a&gt; in relation to a TKG deployment&lt;/li&gt;
&lt;li&gt;For this blog I’ve already deployed my TKG Management cluster in AWS&lt;/li&gt;
&lt;/ul&gt;

&lt;h6&gt;
  
  
  Deploy a GPU enabled workload cluster
&lt;/h6&gt;

&lt;p&gt;It’s simple, just deploy a workload cluster that for the compute plane nodes (workers) that uses a GPU enabled instance.&lt;/p&gt;

&lt;p&gt;You can create a &lt;a href="https://docs.vmware.com/en/VMware-Tanzu-Kubernetes-Grid/1.4/vmware-tanzu-kubernetes-grid-14/GUID-tanzu-config-reference.html#amazon-ec2-12"&gt;new cluster YAML file&lt;/a&gt; from scratch, or clone one of your existing located in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;~/.config/tanzu/tkg/clusterconfigs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Below are the four main values you will need to change. As mentioned above, you need a GPU enabled instance, and for the OS to be Ubuntu. The OS version will default if not set to 20.04.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CONTROL_PLANE_MACHINE_TYPE: t3.large
NODE_MACHINE_TYPE: g4dn.xlarge
OS_ARCH: amd64
OS_NAME: ubuntu
OS_VERSION: "20.04
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The rest of the file you configure as you would for any workload cluster deployment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/TKG-with-GPU-workload-cluster-file.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--xyWDvEZK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/TKG-with-GPU-workload-cluster-file.png%3Fresize%3D604%252C987%26ssl%3D1" alt="TKG with GPU workload cluster file" width="604" height="987"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Create the cluster.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tanzu cluster create {name} -f {cluster.yaml}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can retrieve the kubeadmin file to login by running.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;tanzu cluster kubeconfig get {cluster_name} --admin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/tanzu-cluster-create-kubeconfig-get.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--_7HfsYtp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/12/tanzu-cluster-create-kubeconfig-get.png%3Fresize%3D604%252C196%26ssl%3D1" alt="tanzu cluster create - kubeconfig get" width="604" height="196"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  Deploying the Nvidia Kubernetes Operator
&lt;/h6&gt;

&lt;ul&gt;
&lt;li&gt;Change the kubectl context to your newly deployed cluster.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Deploying the Nvidia operator couldn’t be easier, you can either download the files from the Cluster API for AWS github repo, or directly install them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://raw.githubusercontent.com/kubernetes-sigs/cluster-api-provider-aws/de4fd54e6f988ca7fd3f94bce46867ba0523e23b/test/e2e/data/infrastructure-aws/gpu/clusterpolicy-crd.yaml"&gt;GPU cluster policy resource definition&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://raw.githubusercontent.com/kubernetes-sigs/cluster-api-provider-aws/de4fd54e6f988ca7fd3f94bce46867ba0523e23b/test/e2e/data/infrastructure-aws/gpu/gpu-operator-components.yaml"&gt;GPU operator components&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/cluster-api-provider-aws/de4fd54e6f988ca7fd3f94bce46867ba0523e23b/test/e2e/data/infrastructure-aws/gpu/clusterpolicy-crd.yaml

kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/cluster-api-provider-aws/de4fd54e6f988ca7fd3f94bce46867ba0523e23b/test/e2e/data/infrastructure-aws/gpu/gpu-operator-components.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/Install-Nvidia-Kubernetes-Operator.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--eZw1IpGH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/Install-Nvidia-Kubernetes-Operator.png%3Fresize%3D604%252C169%26ssl%3D1" alt="Install Nvidia Kubernetes Operator" width="604" height="169"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  Validate the installation
&lt;/h6&gt;

&lt;p&gt;Validate the operator pods in the default namespace, and then “nvidia” pods in the namespace “gpu-operator-resources”.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get pods

kubectl get pods -n gpu-operator-resources
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/validate-nvidia-operator-installation-kubectl-get-pods-n-gpu-operator-resources.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FxniAZ9G--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/validate-nvidia-operator-installation-kubectl-get-pods-n-gpu-operator-resources.png%3Fresize%3D604%252C180%26ssl%3D1" alt="validate nvidia operator installation - kubectl get pods -n gpu-operator-resources" width="604" height="180"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you scale out your cluster with additional nodes, the Nvidia operator will ensure the additional pods run on the new nods.&lt;/p&gt;

&lt;h6&gt;
  
  
  Running the Sample Applications
&lt;/h6&gt;

&lt;p&gt;From here to further validate, I am running the &lt;a href="https://docs.nvidia.com/datacenter/cloud-native/gpu-operator/getting-started.html#running-sample-gpu-applications"&gt;sample applications&lt;/a&gt; from the Nvidia documentation.&lt;/p&gt;

&lt;p&gt;So rather than copy the exact configs here, I’m just showing the outputs.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CUDA VectorAdd&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/kubectl-create-cuda-vectoradd.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1OF76qna--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/12/kubectl-create-cuda-vectoradd.png%3Fresize%3D604%252C351%26ssl%3D1" alt="kubectl create cuda-vectoradd" width="604" height="351"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CUDA load generator&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/kubectl-create-CUDA-load-generator-FP16-Matrix-multiply.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Dg7UW2jp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/12/kubectl-create-CUDA-load-generator-FP16-Matrix-multiply.png%3Fresize%3D604%252C1106%26ssl%3D1" alt="kubectl create CUDA load generator FP16 Matrix multiply" width="604" height="1106"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to look at further examples, Nvidia have some fantastic Deep Learning examples in this repository.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/NVIDIA/DeepLearningExamples"&gt;https://github.com/NVIDIA/DeepLearningExamples&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h6&gt;
  
  
  Wrap-up and Resources
&lt;/h6&gt;

&lt;p&gt;Hopefully you can see that to use the GPU support with a Tanzu Kubernetes Grid cluster is quick and simple to setup and consume.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Blog – &lt;a href="https://tanzu.vmware.com/content/blog/tanzu-kubernetes-grid-supports-gpus-across-clouds"&gt;VMware Tanzu Kubernetes Grid Now Supports GPUs Across Clouds&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Documentation

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.vmware.com/en/VMware-Tanzu-Kubernetes-Grid/1.4/vmware-tanzu-kubernetes-grid-14/GUID-tanzu-k8s-clusters-aws.html"&gt;Deploy Tanzu Kubernetes Clusters to Amazon EC2&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.vmware.com/en/VMware-Tanzu-Kubernetes-Grid/1.4/vmware-tanzu-kubernetes-grid-14/GUID-tanzu-k8s-clusters-aws.html#deploy-a-gpuenabled-cluster-6"&gt;Deploy a GPU-Enabled Cluster&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Regards&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/saintdle"&gt;Follow @Saintdle&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://uk.linkedin.com/in/saintdle?trk=profile-badge"&gt;Dean Lewis&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://veducate.co.uk/deploying-gpu-enabled-tanzu-kubernetes-clusters/"&gt;Deploying Nvidia GPU enabled Tanzu Kubernetes Clusters&lt;/a&gt; appeared first on &lt;a href="https://veducate.co.uk"&gt;vEducate.co.uk&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>vmware</category>
      <category>kubernetes</category>
      <category>aws</category>
      <category>gpu</category>
    </item>
    <item>
      <title>Upgrading the vSphere CSI Driver (Storage Container Plugin) from v2.1.0 to latest</title>
      <dc:creator>Dean</dc:creator>
      <pubDate>Mon, 15 Nov 2021 21:54:10 +0000</pubDate>
      <link>https://dev.to/saintdle/upgrading-the-vsphere-csi-driver-storage-container-plugin-from-v210-to-latest-2fhf</link>
      <guid>https://dev.to/saintdle/upgrading-the-vsphere-csi-driver-storage-container-plugin-from-v210-to-latest-2fhf</guid>
      <description>&lt;p&gt;In this post I’m just documenting the steps on how to upgrade the vSphere CSI Driver, especially if you must make a jump in versioning to the latest version.&lt;/p&gt;

&lt;h6&gt;
  
  
  Upgrade from pre-v2.3.0 CSI Driver version to v2.3.0
&lt;/h6&gt;

&lt;p&gt;You need to figure out what version of the vSphere CSI Driver you are running.&lt;/p&gt;

&lt;p&gt;For me it was easy as I could look up the &lt;a href="https://docs.vmware.com/en/VMware-Tanzu-Kubernetes-Grid/1.3/rn/VMware-Tanzu-Kubernetes-Grid-13-Release-Notes.html"&gt;Tanzu Kubernetes Grid release notes&lt;/a&gt;. Please refer to your deployment manifests in your cluster. If you are still unsure, contact VMware Support for assistance.&lt;/p&gt;

&lt;p&gt;Then you need to find your manifests for your associated version. You can do this by viewing the &lt;a href="https://github.com/kubernetes-sigs/vsphere-csi-driver/tags"&gt;releases by tag. &lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Then remove the resources created by the associated manifests. Below are the commands to remove the version 2.1.0 installation of the CSI.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl delete -f https://raw.githubusercontent.com/kubernetes-sigs/vsphere-csi-driver/v2.1.0/manifests/latest/vsphere-7.0u1/vanilla/deploy/vsphere-csi-controller-deployment.yaml

kubectl delete -f https://raw.githubusercontent.com/kubernetes-sigs/vsphere-csi-driver/v2.1.0/manifests/latest/vsphere-7.0u1/vanilla/deploy/vsphere-csi-node-ds.yaml

kubectl delete -f https://raw.githubusercontent.com/kubernetes-sigs/vsphere-csi-driver/v2.1.0/manifests/latest/vsphere-7.0u1/vanilla/rbac/vsphere-csi-controller-rbac.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/11/vsphere-csi-delete-manifests.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--f1nxZjcg--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/11/vsphere-csi-delete-manifests.jpg%3Fresize%3D604%252C87%26ssl%3D1" alt="vsphere-csi - delete manifests" width="604" height="87"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now we need to create the new namespace, “vmware-system-csi”, where all new and future vSphere CSI Driver components will run.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/vsphere-csi-driver/v2.3.0/manifests/vanilla/namespace.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next, we migrate the existing vSphere configuration secret from its location in the “kube-system” namespace to the new “vmware-system-csi” namespace.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get secret vsphere-config-secret --namespace=kube-system -o yaml | sed 's/namespace: .*/namespace: vmware-system-csi/' | kubectl apply -f -
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Delete the original secret in the “kube-system” namespace.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl delete secret vsphere-config-secret --namespace=kube-system
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now to deploy the manifests for the vSphere CSI Driver version 2.3.0&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/vsphere-csi-driver/v2.3.0/manifests/vanilla/vsphere-csi-driver.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Below you can see all the commands running in my environment.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/11/vsphere-csi-create-namespace-move-secret-apply-new-manifests.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BNGMsd-m--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/11/vsphere-csi-create-namespace-move-secret-apply-new-manifests.jpg%3Fresize%3D604%252C112%26ssl%3D1" alt="vsphere-csi - create namespace - move secret - apply new manifests" width="604" height="112"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can scale the deployment of the vSphere CSI Controller to match the number of Control-Plane nodes in your environment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl scale deployment vsphere-csi-controller --replicas=1 -n vmware-system-csi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can check the pods status by running the following command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get pods -n vmware-system-csi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/11/vsphere-csi-kubectl-get-pods.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--fH9uiRXH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/11/vsphere-csi-kubectl-get-pods.jpg%3Fresize%3D603%252C136%26ssl%3D1" alt="vsphere-csi - kubectl get pods" width="603" height="136"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now to check that I can successfully create a PVC and associated Persistent Volume on the vSphere environment still. I used my trusty &lt;a href="https://github.com/saintdle/pacman-tanzu"&gt;Pac-Man application&lt;/a&gt; for this test.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/11/vsphere-csi-test-storage-creation.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KUPnFk_T--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/11/vsphere-csi-test-storage-creation.jpg%3Fresize%3D604%252C115%26ssl%3D1" alt="vsphere-csi - test storage creation" width="604" height="115"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  Upgrade from v2.3.0 to the latest
&lt;/h6&gt;

&lt;p&gt;Now you can upgrade to the latest version, currently v2.4.0, by running the below command.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/vsphere-csi-driver/v2.4.0/manifests/vanilla/vsphere-csi-driver.yaml
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h6&gt;
  
  
  Summary and wrap-up
&lt;/h6&gt;

&lt;p&gt;The steps do &lt;a href="https://docs.vmware.com/en/VMware-vSphere-Container-Storage-Plug-in/2.0/vmware-vsphere-csp-getting-started/GUID-3F277B52-68CC-4125-AD0F-E7293940B4B4.html"&gt;follow the documentation&lt;/a&gt;, the main points to remember, if you are running a version below v2.3.0, you need to get to v2.3.0 before then upgrading to the latest version. There will be no changes to your PVCs or PVs.&lt;/p&gt;

&lt;p&gt;But if you are unsure about any configuration changes or the status of your environment, log a support call with VMware Support for assistance and validation.&lt;/p&gt;

&lt;p&gt;Regards&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/saintdle"&gt;Follow @Saintdle&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://uk.linkedin.com/in/saintdle?trk=profile-badge"&gt;Dean Lewis&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://veducate.co.uk/upgrading-vsphere-csi-driver/"&gt;Upgrading the vSphere CSI Driver (Storage Container Plugin) from v2.1.0 to latest&lt;/a&gt; appeared first on &lt;a href="https://veducate.co.uk"&gt;vEducate.co.uk&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>vmware</category>
      <category>kubernetes</category>
      <category>cns</category>
      <category>csi</category>
    </item>
    <item>
      <title>First Look – Setup Tanzu Build Services and rebuilding Pac-Man</title>
      <dc:creator>Dean</dc:creator>
      <pubDate>Thu, 11 Nov 2021 00:44:56 +0000</pubDate>
      <link>https://dev.to/saintdle/first-look-setup-tanzu-build-services-and-rebuilding-pac-man-2i6g</link>
      <guid>https://dev.to/saintdle/first-look-setup-tanzu-build-services-and-rebuilding-pac-man-2i6g</guid>
      <description>&lt;p&gt;This blog post will detail how to setup Tanzu Build Services in a test environment, and then create a container image from a dockerfile, fixing several vulnerabilities compared to the current container image.&lt;/p&gt;

&lt;h6&gt;
  
  
  What is Tanzu Build Service?
&lt;/h6&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Tanzu Build Service uses the open-source [Cloud Native Buildpacks](https://buildpacks.io) project to turn application source code into [container images](https://github.com/opencontainers/image-spec/blob/master/spec.md). 

Build Service executes reproducible builds that align with modern container standards, and additionally keeps image resources up-to-date. It does so by leveraging Kubernetes infrastructure with [kpack](https://github.com/pivotal/kpack), a Cloud Native Buildpacks Platform, to orchestrate the image lifecycle. 

Build Service helps you develop and automate containerized software workflows securely and at scale.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can read more about the Tanzu Build Services &lt;a href="https://docs.vmware.com/en/Tanzu-Build-Service/1.3/vmware-tanzu-build-service-v13/GUID-docs-build-service-index.html"&gt;concepts here.&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  Pre-Reqs
&lt;/h6&gt;

&lt;p&gt;Have an accessible Image Registry to both your local client and your Kubernetes cluster.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I used Dockerhub for my lab environment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Install the &lt;a href="https://carvel.dev/"&gt;Carvel tools&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://network.tanzu.vmware.com/products/kapp/"&gt;kapp&lt;/a&gt; is a deployment tool that allows users to manage Kubernetes resources in bulk.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://network.tanzu.vmware.com/products/ytt/"&gt;ytt&lt;/a&gt; is a templating tool that understands YAML structure.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://network.tanzu.vmware.com/products/kbld/"&gt;kbld&lt;/a&gt; is needed to map relocated images to k8s config.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://network.tanzu.vmware.com/products/imgpkg/"&gt;imgpkg&lt;/a&gt; is tool that relocates container images and pulls the release configuration files.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;brew tap vmware-tanzu/carvel

brew install ytt kbld kapp imgpkg kwt vendir
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Install the &lt;a href="https://github.com/vmware-tanzu/kpack-cli/tree/main"&gt;kp cli tool&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Download from the Tanzu Network pages

chmod +x kp-linux-0.4.0 
sudo mv kp-linux-0.4.0 /usr/bin/local/kp

# Install using Brew

brew tap vmware-tanzu/kpack-cli
brew install kp

# Download from GitHub Releases Page
curl -LJO https://github.com/vmware-tanzu/kpack-cli/releases/download/v0.4.2/kp-linux-0.4.2
chmod +x kp-linux-0.4.2
sudo mv kp-linux-0.4.2 /usr/bin/local/kp
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h6&gt;
  
  
  Installing Tanzu Build Services
&lt;/h6&gt;

&lt;p&gt;Log in to your registry that will host the Build Services containers and be used by your Kubernetes cluster&lt;/p&gt;

&lt;p&gt;Login to the Tanzu Registry using your Tanzu Network login details.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker login registry.tanzu.vmware.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Login to your local Image Repository.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker login **{repo\_url}**
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Copy the images from the Tanzu Registry to your registry suing the imgpkg tool.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;imgpkg copy -b "registry.tanzu.vmware.com/build-service/bundle: **{version}**" --to-repo **{repo\_url}**

# Example
imgpkg copy -b "registry.tanzu.vmware.com/build-service/bundle:1.3.0" --to-repo saintdle/tbs
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pull the image manifests locally.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;imgpkg pull -b **{repo\_url}** -o **{location}**

# Example
imgpkg pull -b "saintdle/tbs:1.3.0" -o /tmp/bundle
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/11/Tanzu-Build-Services-imgpkg-copy-b-remote-url-to-repo-local-url.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Z405wToH--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/11/Tanzu-Build-Services-imgpkg-copy-b-remote-url-to-repo-local-url.jpg%3Fresize%3D604%252C365%26ssl%3D1" alt="Tanzu Build Services - imgpkg copy -b remote-url --to-repo local-url" width="604" height="365"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now to deploy Tanzu Build Services, we’ll use the yyt tooling to map values across as needed into the various files:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Local Image Repo URL

&lt;ul&gt;
&lt;li&gt;Username and Password&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Tanzu Net username and password
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ytt -f bundle/values.yaml \
     -f bundle/config/ \
 -v kp_default_repository='{repo_url}' \
 -v kp_default_repository_username='{username}' \
 -v kp_default_repository_password='{password}' \
 -v pull_from_kp_default_repo=true \
 -v tanzunet_username='' \
 -v tanzunet_password='' \
 | kbld -f bundle/.imgpkg/images.yml -f- \
 | kapp deploy -a tanzu-build-service -f- -y
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Below is a concatenated output once the command is run.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/11/Tanzu-Build-Services-ytt-f-bundle-values.yaml-f-bundle-config-v-kp_default_repository.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WoCgVbqq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/11/Tanzu-Build-Services-ytt-f-bundle-values.yaml-f-bundle-config-v-kp_default_repository.jpg%3Fresize%3D604%252C1030%26ssl%3D1" alt="Tanzu Build Services - ytt -f bundle values.yaml -f bundle config -v kp_default_repository" width="604" height="1030"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To check the installation&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kp clusterbuilder list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/11/Tanzu-Build-Services-kp-clusterbuild-list.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ruoOHbLa--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/11/Tanzu-Build-Services-kp-clusterbuild-list.jpg%3Fresize%3D604%252C93%26ssl%3D1" alt="Tanzu Build Services - kp clusterbuild list" width="604" height="93"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  (Re)Building the Pac-Man Application
&lt;/h6&gt;

&lt;p&gt;Now that Tanzu Build Services is deployed within my cluster. Let’s look at taking an existing application and repacking it into a container using the functions of Tanzu Build Services to inject various layers into the container and resolve issues such as vulnerabilities.&lt;/p&gt;

&lt;p&gt;I use the same Pac-Man application in my demos, as it’s fun, but also does somewhat mirror a real-world application, as it has a web front end and a database backend.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/saintdle/pacman-tanzu"&gt;GitHub Repo for Pac-Man for Kubernetes/Tanzu&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The Web Front end is a container built by &lt;a href="https://github.com/font"&gt;Ivan Font.&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;quay.io/ifont/pacman-nodejs-app:latest&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ivan has also provided his Dockerfile for this container here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/font/pacman"&gt;https://github.com/font/pacman&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I &lt;a href="https://github.com/saintdle/pacman"&gt;forked&lt;/a&gt; this repo, and then without making any changes currently. I ran the commands for Tanzu Build Services to build me a new container and fix some of the dependency issues straight away.&lt;/p&gt;

&lt;p&gt;First, we need to create a secret for the kp tool to use to upload our images to the registry.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kp secret create my-dockerhhub-creds --dockerhub saintdle

# you will be prompted to enter the password for the account
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/11/Tanzu-Build-Services-kp-secret-create-my-dockerhhub-creds-dockerhub-.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9KPAcVCY--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/11/Tanzu-Build-Services-kp-secret-create-my-dockerhhub-creds-dockerhub-.jpg%3Fresize%3D604%252C32%26ssl%3D1" alt="Tanzu Build Services - kp secret create my-dockerhhub-creds --dockerhub" width="604" height="32"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, we run the command to compile the new image.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kp image create pacman-test3 --tag saintdle/pacmantest:0.1 --git https://github.com/saintdle/pacman.git

# specify a certain branch
kp image create {name} --tag {repository location to create image} --git {git url} --git-revision {git branch or commit}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/11/Tanzu-Build-Services-kp-image-create-pacman-test3-tag-git.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--74Ia6iw7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/11/Tanzu-Build-Services-kp-image-create-pacman-test3-tag-git.jpg%3Fresize%3D604%252C36%26ssl%3D1" alt="Tanzu Build Services - kp image create pacman-test3 --tag --git" width="604" height="36"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can then monitor the build process with the following commands.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kp build list pacman-test3

# you can add the watch command infront of this to cycle the command/response

watch kp build list pacman-test3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/11/Tanzu-Build-Services-kp-build-list.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NEPF1t4K--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/11/Tanzu-Build-Services-kp-build-list.jpg%3Fresize%3D604%252C52%26ssl%3D1" alt="Tanzu Build Services - kp build list" width="604" height="52"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You can view further build details by viewing the logs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kp build logs pacman-test3
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The build process goes through the following stages, and you check out the full output in my example in the image below:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Setup CA certs for the repo that the process is pushing the image to&lt;/li&gt;
&lt;li&gt;Prepare the source files&lt;/li&gt;
&lt;li&gt;Detect the build packs that will be needed for this image build run&lt;/li&gt;
&lt;li&gt;Analyze if any elements reuse existing cached data&lt;/li&gt;
&lt;li&gt;Restore any cached data as needed&lt;/li&gt;
&lt;li&gt;Build our new image&lt;/li&gt;
&lt;li&gt;Export our image to our container image registry&lt;/li&gt;
&lt;li&gt;Completion – finalisation messaging&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/11/Tanzu-Build-Services-kp-build-logs-pacman.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s---mXxam1Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/11/Tanzu-Build-Services-kp-build-logs-pacman.jpg%3Fresize%3D604%252C1088%26ssl%3D1" alt="Tanzu Build Services - kp build logs - pacman" width="604" height="1088"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  Testing the new Image
&lt;/h6&gt;

&lt;p&gt;As I’m doing this as a first look and not really reading any documentation and jumping straight in, I don’t have this as part of a CI/CD pipeline.&lt;/p&gt;

&lt;p&gt;I just ran the new container image in docker locally on it’s own to make sure it works and exposed the port 8080 to port 80.&lt;/p&gt;

&lt;p&gt;Locally on my machine Pac-Man loads. However, fitting this into a wider deployment, there are more considerations to think about. And that is for another day and another blog post.&lt;/p&gt;

&lt;h6&gt;
  
  
  Comparing the original and new images
&lt;/h6&gt;

&lt;p&gt;I uploaded the original container image and new container image to a Harbor repository, so that I could use the Trivvy Scanner functions to see the vulnerabilities in both container images.&lt;/p&gt;

&lt;p&gt;The below screenshot shows the original container image that I’ve been using. As we can see there are a high number of issues that need to be addressed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/11/Tanzu-Build-Services-Original-pacman-container-before-build-services.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--MXir8JO0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/11/Tanzu-Build-Services-Original-pacman-container-before-build-services.jpg%3Fresize%3D604%252C286%26ssl%3D1" alt="Tanzu Build Services - Original pacman container - before build services" width="604" height="286"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Below is my new container image built by Tanzu Build Services. As you can see there is far less CVEs reported, and the container image size is also a lot smaller as well.&lt;/p&gt;

&lt;p&gt;The key thing here to note is, I have changed nothing here with the original dockerfile used to create the containers. I’m simply run this through Build Services, which has discovered the components, and made decisions about how this is packaged together.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/11/Tanzu-Build-Services-New-pacman-container-after-build-services.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--By2wTxXO--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/11/Tanzu-Build-Services-New-pacman-container-after-build-services.jpg%3Fresize%3D604%252C293%26ssl%3D1" alt="Tanzu Build Services - New pacman container - after build services" width="604" height="293"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  Wrap up
&lt;/h6&gt;

&lt;p&gt;In this blog post, I’ve covered a very quick setup in a lab environment to look at how Tanzu Build Services works and run a dockerfile of an existing application through it.&lt;/p&gt;

&lt;p&gt;There is a lot more to cover here though:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;How to troubleshoot builds,&lt;/li&gt;
&lt;li&gt;How to tailor builds to specific needs&lt;/li&gt;
&lt;li&gt;Updating images when the sources are changed or have new commits&lt;/li&gt;
&lt;li&gt;Bringing this into a full CI/CD pipeline and tool chain&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And I assume even more items I’m not currently considering.&lt;/p&gt;

&lt;p&gt;Regards&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/saintdle"&gt;Follow @Saintdle&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://uk.linkedin.com/in/saintdle?trk=profile-badge"&gt;Dean Lewis&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://veducate.co.uk/tanzu-build-services-rebuilding-pac-man/"&gt;First Look – Setup Tanzu Build Services and rebuilding Pac-Man&lt;/a&gt; appeared first on &lt;a href="https://veducate.co.uk"&gt;vEducate.co.uk&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>vmware</category>
      <category>buildpacks</category>
      <category>install</category>
    </item>
    <item>
      <title>Quick Tip – Kubernetes – Delete all evicted pods across all namespaces</title>
      <dc:creator>Dean</dc:creator>
      <pubDate>Mon, 08 Nov 2021 11:15:57 +0000</pubDate>
      <link>https://dev.to/saintdle/quick-tip-kubernetes-delete-all-evicted-pods-across-all-namespaces-2kcf</link>
      <guid>https://dev.to/saintdle/quick-tip-kubernetes-delete-all-evicted-pods-across-all-namespaces-2kcf</guid>
      <description>&lt;p&gt;I’m currently troubleshooting an issue with my Kubernetes clusters where pods keep getting evicted, and this is happening across namespaces as well.&lt;/p&gt;

&lt;p&gt;The issue now that I am faced with, is being able to keep ontop of the issues. When I run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get pods -A | grep Evicted
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I’m presented with 100’s of returned results.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/11/kubectl-get-pods-A-grep-Evicted.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oEnNnJdB--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/11/kubectl-get-pods-A-grep-Evicted.jpg%3Fresize%3D604%252C62%26ssl%3D1" alt="kubectl get pods -A grep Evicted" width="604" height="62"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So to quickly clean this up, I can run the following command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get pods -A | grep Evicted | awk '{print $1,$2,$4}' | xargs kubectl delete pod $2 -n $1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Breaking down the command:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Get all pods across all namespaces&lt;/li&gt;
&lt;li&gt;Filter by term “Evicted”&lt;/li&gt;
&lt;li&gt;Manipulate the output by selecting the data in field 1, 2 and 4&lt;/li&gt;
&lt;li&gt;Use xargs to read from the standard output to place the data from the previous pipe into the “kubectl” command.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This command will cycle and remove everything you need. You can use this command line for other status of pods if needed.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/11/kubectl-get-pods-A-grep-Evicted-awk-xargs-kubectl-delete-pod.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Md_qb03X--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/11/kubectl-get-pods-A-grep-Evicted-awk-xargs-kubectl-delete-pod.jpg%3Fresize%3D604%252C53%26ssl%3D1" alt="kubectl get pods -A grep Evicted awk xargs kubectl delete pod" width="604" height="53"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now I need to get back to troubleshooting my cluster issues.&lt;/p&gt;

&lt;p&gt;Regards&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/saintdle"&gt;Follow @Saintdle&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://uk.linkedin.com/in/saintdle?trk=profile-badge"&gt;Dean Lewis&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://veducate.co.uk/quick-tip-kubernetes-delete-all-evicted-pods-across-all-namespaces/"&gt;Quick Tip – Kubernetes – Delete all evicted pods across all namespaces&lt;/a&gt; appeared first on &lt;a href="https://veducate.co.uk"&gt;vEducate.co.uk&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>awk</category>
      <category>delete</category>
      <category>pod</category>
    </item>
    <item>
      <title>Kasten K10 – Air gap installation using Harbor Image Registry</title>
      <dc:creator>Dean</dc:creator>
      <pubDate>Tue, 26 Oct 2021 19:03:14 +0000</pubDate>
      <link>https://dev.to/saintdle/kasten-k10-air-gap-installation-using-harbor-image-registry-mn6</link>
      <guid>https://dev.to/saintdle/kasten-k10-air-gap-installation-using-harbor-image-registry-mn6</guid>
      <description>&lt;p&gt;In this blog post, I will cover the steps for an air-gap installation for Kasten K10. For situations where your Kubernetes cluster doesn’t have available internet access to pull down the container images directly from their online locations.&lt;/p&gt;

&lt;h6&gt;
  
  
  Pre-requisites
&lt;/h6&gt;

&lt;ul&gt;
&lt;li&gt;Image Registry that is accessible by your Kubernetes cluster

&lt;ul&gt;
&lt;li&gt;In this example I am using the &lt;a href="https://goharbor.io/"&gt;Harbor Image Registry&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Client that has access to download the container images and then to the Image Registry

&lt;ul&gt;
&lt;li&gt;In this example, I am using my local machine which has docker installed.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Helm downloaded

&lt;ul&gt;
&lt;li&gt;Run the following to get the helm files locally for the install.
&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;helm repo update &amp;amp;&amp;amp; \
    helm fetch kasten/k10 --version=&amp;lt;k10-version&amp;gt;

**Example for Kasten K10 4.5.0**

helm repo update &amp;amp;&amp;amp; \ 
    helm fetch kasten/k10 --version=4.5.0

This will download a file, for example "k10-4.5.0.tgz"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h6&gt;
  
  
  Log into your Image Registry
&lt;/h6&gt;

&lt;p&gt;First you need to ensure that your docker client (or similar) has authenticated to your Image Registry which your air-gap Kubernetes cluster can access.&lt;/p&gt;

&lt;p&gt;When using Harbor and Docker, I typically use this method with a &lt;a href="https://veducate.co.uk/authenticate-docker-harbor-robot/"&gt;robot account for programmatic access&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;However, when running the Kasten tooling which we’ll discuss next, I kept hitting an error.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;54e42005468d: Waiting  File=kasten.io/k10/kio/tools/k10offline/k10offline.go Function=kasten.io/k10/kio/tools/k10offline.PushK10Images Line=179 hostname=3ffc0162e190

Error: {"message":"Failed to push K10 container images to harbor-repo.veducate.co.uk/deanl","function":"main.pullImages","linenumber":171,"cause":{"message":"Failed to push","function":"kasten.io/k10/kio/tools/k10offline.PushK10Images","linenumber":181,"fields":[{"name":"image","value":"harbor-repo.veducate.co.uk/deanl/kanister-tools:k10-0.69.0"}],"cause":{"Stderr":" **dW5hdXRob3JpemVkOiB1bmF1dGhvcml6ZWQgdG8gYWNjZXNzIHJlcG9zaXRvcnk6IGRlYW5sL2thbmlzdGVyLXRvb2xzLCBhY3Rpb246IHB1c2g6IHVuYXV0aG9yaXplZCB0byBhY2Nlc3MgcmVwb3NpdG9yeTogZGVhbmwva2FuaXN0ZXItdG9vbHMsIGFjdGlvbjogcHVzaAo=**"}}}

**Base64 decode the message above in light bold provides you the response:**

unauthorized: unauthorized to access repository: deanl/kanister-tools, action: push: unauthorized to access repository: deanl/kanister-tools, action: push
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To resolve this, I had to remove the credsStore line from my ~/.docker/config.json file. Then log into my Harbor registry using the above method.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This does mean your auth account details are stored in a JSON file locally.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/10/docker-login-remove-credsStore.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--OH5CqbBp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/10/docker-login-remove-credsStore.jpg%3Fresize%3D604%252C383%26ssl%3D1" alt="docker login - remove credsStore" width="604" height="383"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  Pull down the Kasten K10 images locally and Push to internal Air-Gap Image Registry
&lt;/h6&gt;

&lt;p&gt;Kasten has provided an easy-to-use tool which can run locally on your docker client to make pulling the necessary images simple.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run --rm -ti -v /var/run/docker.sock:/var/run/docker.sock \
    -v ${HOME}/.docker:/root/.docker \
    gcr.io/kasten-images/k10offline: **{TAG}** pull images

# Example with Tag

docker run --rm -ti -v /var/run/docker.sock:/var/run/docker.sock \
    -v ${HOME}/.docker:/root/.docker \
    gcr.io/kasten-images/k10offline:4.5.0 pull images
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;By specifying the appropriate tag, you this will use a container image to pull down all the containers and store them within your docker client. To push to an internal repo, you simply add the argument:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;--newrepo {repo url}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;For example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;docker run --rm -ti -v /var/run/docker.sock:/var/run/docker.sock \
    -v ${HOME}/.docker:/root/.docker \
    gcr.io/kasten-images/k10offline:4.5.0 pull images --newrepo harbor-repo.veducate.co.uk/deanl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The below image shows the tool download containers and pushing them to the repo.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/10/docker-run-k10offline-4.5.0-pull-images-newrepo-.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0IEBfRmx--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/10/docker-run-k10offline-4.5.0-pull-images-newrepo-.jpg%3Fresize%3D604%252C147%26ssl%3D1" alt="docker run k10offline-4.5.0 pull images --newrepo" width="604" height="147"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here are my images in Harbor.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/10/harbor-kasten-images.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--1GjpnGZl--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/10/harbor-kasten-images.jpg%3Fresize%3D604%252C242%26ssl%3D1" alt="harbor - kasten images" width="604" height="242"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  Installing Kasten K10 with a local Helm Chart and Container Images
&lt;/h6&gt;

&lt;p&gt;Create your Kasten namespace&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl create namespace kasten-io
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then run the following Helm command&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;helm install k10 k10-4.5.0.tgz --namespace kasten-io \
--set global.airgapped.repository= **{registry URL}**

# Example

helm install k10 k10-4.5.0.tgz --namespace kasten-io \
  --set global.airgapped.repository=harbor-repo.veducate.co.uk/deanl
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/10/air-gap-helm-install-k10-k10-4.5.0.tgz-set-global.airgapped.repository.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--z5mrSakf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/10/air-gap-helm-install-k10-k10-4.5.0.tgz-set-global.airgapped.repository.jpg%3Fresize%3D604%252C375%26ssl%3D1" alt="air gap - helm install k10 k10-4.5.0.tgz --set global.airgapped.repository" width="604" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can now watch the pods start by using the command:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get pods -n kasten-io -w
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/10/air-gap-kubectl-get-pods-n-kasten-io-w.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--CjxeTZL6--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/10/air-gap-kubectl-get-pods-n-kasten-io-w.jpg%3Fresize%3D586%252C316%26ssl%3D1" alt="air gap - kubectl get pods -n kasten-io -w" width="586" height="316"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We can check these are coming from our local image repository by running the describe command against one of our pods.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/10/air-gap-describe-pod-pulled-from-airgap-repo.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--B7TUpMDj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/10/air-gap-describe-pod-pulled-from-airgap-repo.jpg%3Fresize%3D604%252C221%26ssl%3D1" alt="air gap - describe pod - pulled from airgap repo" width="604" height="221"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Finally, we can also see pulls in our Harbor image registry as well.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/10/harbor-kasten-image-pulls.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--b7rRVZJ5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/10/harbor-kasten-image-pulls.jpg%3Fresize%3D604%252C217%26ssl%3D1" alt="harbor - kasten image pulls" width="604" height="217"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Kasten has made it easy to perform an air-gap internet restricted installation of their software in a Kubernetes cluster, made especially easy thanks to the little k10offline tool you run in your docker client to grab the necessary images for you.&lt;/p&gt;

&lt;p&gt;I did hit that little authentication issue where I had to remove the credsStore in docker, due to the way the tool reads the Image Registry auth details. I messaged the Kasten support team about this and they were quick to give me the workaround I documented earlier.&lt;/p&gt;

&lt;p&gt;I’m not going to say outside of this I did anything more than follow the &lt;a href="https://docs.kasten.io/latest/install/offline.html"&gt;Kasten docs on the subject&lt;/a&gt;. But I always feel sometimes it’s good to add some more context and colour with screenshots and using real environments to demonstrate these capabilities and configurations.&lt;/p&gt;

&lt;p&gt;Regards&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/saintdle"&gt;Follow @Saintdle&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://uk.linkedin.com/in/saintdle?trk=profile-badge"&gt;Dean Lewis&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://veducate.co.uk/kasten-air-gap/"&gt;Kasten K10 – Air gap installation using Harbor Image Registry&lt;/a&gt; appeared first on &lt;a href="https://veducate.co.uk"&gt;vEducate.co.uk&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>airgap</category>
      <category>harbor</category>
      <category>install</category>
    </item>
    <item>
      <title>Kubernetes – Kubelet Unable to attach or mount volumes – timed out waiting for the condition</title>
      <dc:creator>Dean</dc:creator>
      <pubDate>Thu, 30 Sep 2021 11:40:00 +0000</pubDate>
      <link>https://dev.to/saintdle/kubernetes-kubelet-unable-to-attach-or-mount-volumes-timed-out-waiting-for-the-condition-31la</link>
      <guid>https://dev.to/saintdle/kubernetes-kubelet-unable-to-attach-or-mount-volumes-timed-out-waiting-for-the-condition-31la</guid>
      <description>&lt;h6&gt;
  
  
  The Issue
&lt;/h6&gt;

&lt;p&gt;When I updated my Kasten application in my Kubernetes cluster, I found that one of the pods was stuck in “init” status.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;dean@dean [~] (⎈ |tkg-wld-01-admin@tkg-wld-01:default) # k get pods -n kasten-io -w
NAME READY STATUS RESTARTS AGE
aggregatedapis-svc-78564d4697-wl9wg 1/1 Running 0 3m9s
auth-svc-7977b9684b-zph27 1/1 Running 0 3m11s
catalog-svc-7ff7779b75-kmvsr 0/2 Init:0/2 0 2m43s
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/09/kubectl-get-pods-status-init.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--LzxAsVop--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/09/kubectl-get-pods-status-init.jpg%3Fresize%3D602%252C104%26ssl%3D1" alt="kubectl get pods - status init"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Running a describe on that pod pointed to the fact the volume could not be attached.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Events:
Type Reason Age From Message
--------- ------ ---- ---- -------
Normal Scheduled 2m58s default-scheduler Successfully assigned kasten-io/catalog-svc-7ff7779b75-kmvsr to tkg-wld-01-md-0-54598b8d99-rpqjf
Warning FailedMount 55s kubelet Unable to attach or mount volumes: unmounted volumes=[catalog-persistent-storage], unattached volumes=[k10-k10-token-lbqpw catalog-persistent-storage]: timed out waiting for the condition
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h6&gt;
  
  
  &lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/09/kubelet-Unable-to-attach-or-mount-volumes-unmounted-volumescatalog-persistent-storage-unattached-volumesk10-k10-token-lbqpw-catalog-persistent-storage-timed-out-waiting-for-the-condition.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2IQs0Ye0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/09/kubelet-Unable-to-attach-or-mount-volumes-unmounted-volumescatalog-persistent-storage-unattached-volumesk10-k10-token-lbqpw-catalog-persistent-storage-timed-out-waiting-for-the-condition.jpg%3Fresize%3D604%252C43%26ssl%3D1" alt="kubelet Unable to attach or mount volumes- unmounted volumes=[catalog-persistent-storage], unattached volumes=[k10-k10-token-lbqpw catalog-persistent-storage]- timed out waiting for the condition"&gt;&lt;/a&gt;
&lt;/h6&gt;

&lt;h6&gt;
  
  
  The Cause
&lt;/h6&gt;

&lt;p&gt;Some where along the line I found some stale &lt;a href="https://docs.openshift.com/container-platform/4.8/rest_api/storage_apis/volumeattachment-storage-k8s-io-v1.html"&gt;volumeattachments&lt;/a&gt;linked to Kubernetes node that no longer exist in my cluster. This looks to be causing some confusion in the cluster who should be attaching the volume&lt;/p&gt;

&lt;p&gt;The image below shows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Find the Persistent Volume name linked to the associated claim for the failure in the pod events&lt;/li&gt;
&lt;li&gt;Map this to the available VolumeAttachments&lt;/li&gt;
&lt;li&gt;Reference VolumeAttachments for each node to available nodes in the cluster

&lt;ul&gt;
&lt;li&gt;I’ve highlighted the missing node in the red box&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/09/kubectl-get-pv-get-volumeattachment-get-nodes.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VdEjzaFR--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/09/kubectl-get-pv-get-volumeattachment-get-nodes.jpg%3Fresize%3D604%252C234%26ssl%3D1" alt="kubectl get pv - get volumeattachment - get nodes"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  The Fix
&lt;/h6&gt;

&lt;p&gt;The fix is to remove the stale VolumeAttachment.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl delete volumeattachment [volumeattachment_name]
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/09/kubectl-delete-volumeattachment.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--zVE0DGK9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/09/kubectl-delete-volumeattachment.jpg%3Fresize%3D604%252C28%26ssl%3D1" alt="kubectl delete volumeattachment"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After this your pod should eventually pick up and retry, or you could remove the pod and let Kubernetes replace it for you (so long as it’s part of a deployment or other configuration managing your application).&lt;/p&gt;

&lt;p&gt;Regards&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/saintdle"&gt;Follow @Saintdle&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://uk.linkedin.com/in/saintdle?trk=profile-badge"&gt;Dean Lewis&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://veducate.co.uk/kubelet-unable-attach-volumes/"&gt;Kubernetes – Kubelet Unable to attach or mount volumes – timed out waiting for the condition&lt;/a&gt; appeared first on &lt;a href="https://veducate.co.uk"&gt;vEducate.co.uk&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>kubernetes</category>
    </item>
    <item>
      <title>MongoDB Container data loss issue – A Journey</title>
      <dc:creator>Dean</dc:creator>
      <pubDate>Mon, 30 Aug 2021 09:39:10 +0000</pubDate>
      <link>https://dev.to/saintdle/mongodb-container-data-loss-issue-a-journey-58me</link>
      <guid>https://dev.to/saintdle/mongodb-container-data-loss-issue-a-journey-58me</guid>
      <description>&lt;p&gt;Over the past month or so I noticed an issue with my &lt;a href="//htps://github.com/saintdle/pacman-tanzu"&gt;Pac-Man Kubernetes application&lt;/a&gt;, which I use for demonstrations as a basic app front-end that writes to a database back end, running in Kubernetes.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When I restored my instances &lt;a href="https://veducate.co.uk/kasten-backup-restore/"&gt;using Kasten&lt;/a&gt;, my Pac-Man high scores were missing.&lt;/li&gt;
&lt;li&gt;This issue happened when I made some changes to my deployment files to configure authentication to the MongoDB using environment variables in my deployment file.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This blog post is a detail walk-through of the steps I took to troubleshoot the issue, and then rectify it!&lt;/p&gt;

&lt;h6&gt;
  
  
  Summary if you don’t want to read the post
&lt;/h6&gt;

&lt;p&gt;If you are not looking to read through this blog post, here is the summary:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I changed MongoDB images, I needed to configure a new mount point location to match the MongoDB configuration&lt;/li&gt;
&lt;li&gt;New MongoDB image is non-root, so had to use an Init container to configure the permissions on the PV first&lt;/li&gt;
&lt;/ul&gt;

&lt;h6&gt;
  
  
  Overview of the application
&lt;/h6&gt;

&lt;p&gt;The application is made up of the following components:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Namespace&lt;/li&gt;
&lt;li&gt;Deployment

&lt;ul&gt;
&lt;li&gt;MongoDB Pod&lt;/li&gt;
&lt;li&gt;DB Authentication configured&lt;/li&gt;
&lt;li&gt;Attached to a PVC&lt;/li&gt;
&lt;li&gt;Pac-Man Pod&lt;/li&gt;
&lt;li&gt;Nodejs web front end that connects back to the MongoDB Pod by looking for the Pod DNS address internally.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;RBAC Configuration for Pod Security and Service Account&lt;/li&gt;
&lt;li&gt;Secret which holds the data for the MongoDB Usernames and Passwords to be configured&lt;/li&gt;
&lt;li&gt;Service

&lt;ul&gt;
&lt;li&gt;Type: LoadBalancer&lt;/li&gt;
&lt;li&gt;Used to balance traffic to the Pac-Man Pods&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/08/Pac-Man-Kubernetes-Diagram.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--WSR6_2nQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i1.wp.com/veducate.co.uk/wp-content/uploads/2021/08/Pac-Man-Kubernetes-Diagram.jpg%3Fresize%3D483%252C417%26ssl%3D1" alt="Pac-Man Kubernetes Diagram"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h6&gt;
  
  
  Confirming the behaviour
&lt;/h6&gt;

&lt;p&gt;The behaviour I was seeing when my application was deployed:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Pac-Man web page – I could save a high score, and it would show in the high scores list

&lt;ul&gt;
&lt;li&gt;This showed the connectivity to the database was working, as the app would hang if it could not write to the database.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;I would protect my application using &lt;a href="https://veducate.co.uk/kasten-backup-restore/"&gt;Kasten&lt;/a&gt;. When I deleted the namespace, and restored everything, my application would be running, but there was no high scores to show.&lt;/li&gt;
&lt;li&gt;This was apparent from deploying the branch version &lt;a href="https://github.com/saintdle/pacman-tanzu/tree/v0.5.0"&gt;v0.5.0&lt;/a&gt; and &lt;a href="https://github.com/saintdle/pacman-tanzu/tree/v0.5.1"&gt;v0.5.1&lt;/a&gt; from my GitHub.&lt;/li&gt;
&lt;li&gt;Deploying the &lt;a href="https://github.com/saintdle/pacman-tanzu/tree/v0.2.0"&gt;branch v0.2.0&lt;/a&gt; would not product the same behaviour

&lt;ul&gt;
&lt;li&gt;This configuration did not have any database authentication setup, meaning MongoDB was open to the world if they could connect without a UN/Password.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h6&gt;
  
  
  Testing the Behaviour
&lt;/h6&gt;

&lt;p&gt;First, I deployed my &lt;a href="https://github.com/saintdle/pacman-tanzu/tree/v0.2.0"&gt;branch v0.2.0&lt;/a&gt; code. I saved some high scores, backed up the namespace and artifacts. I then restored everything, and it worked.&lt;/p&gt;

&lt;p&gt;I connected to the shell of my container to look at what was happening.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl exec {podname} -n {namespace} -it -- {cmd}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;From here, I could see my &lt;a href="https://github.com/saintdle/pacman-tanzu/blob/ad41b09fceb7133958684986d8d4897348e6275c/deployments/mongo-deployment.yaml#L26"&gt;mount point&lt;/a&gt; listed correct, and when browsing the mount point, I could see the expected files from MongoDB stored.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    spec:
      serviceAccount: pacman-sa
      containers:
      - image: mongo
        name: mongo
        ports:
        - name: mongo
          containerPort: 27017
        volumeMounts:
          - name: mongo-db
            mountPath: /data/db
      volumes:
        - name: mongo-db
          persistentVolumeClaim:
            claimName: mongo-storage

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/08/kubectl-exec-pod-working-deploying-files-on-disk.png?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--5JKRtJQf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i0.wp.com/veducate.co.uk/wp-content/uploads/2021/08/kubectl-exec-pod-working-deploying-files-on-disk.png%3Fresize%3D604%252C279%26ssl%3D1" alt="kubectl exec pod - working deploying - files on disk"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Next, I deleted this namespace, and redeployed using my branch v0.5.1 code. Ran a game of Pac-Man and saved the high score. Once again this looked to have committed fine. Backup data, kill namespace, and restore using Kasten.&lt;/p&gt;

&lt;p&gt;I run a shell to the pod and browse the mount point again. There is no data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/08/kubectl-exec-pod-non-working-deployment-no-files-in-PV.jpg?ssl=1"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--SxP4sH7k--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://i2.wp.com/veducate.co.uk/wp-content/uploads/2021/08/kubectl-exec-pod-non-working-deployment-no-files-in-PV.jpg%3Fresize%3D604%252C241%26ssl%3D1" alt="kubectl exec pod - non-working deployment - no files in PV"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Ok, so MongoDB is not writing the data to file, which means it’s storing the data in memory for some reason.&lt;/p&gt;

&lt;p&gt;The next steps I took to confirm behaviour:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Restore only the Persistent Volume and connect a test pod to the PV.
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;apiVersion: v1
kind: Pod
metadata:
  name: task-pv-pod
  namespace: pacman
spec:
  volumes:
    - name: mongo-storage
      persistentVolumeClaim:
        claimName: mongo-storage
  containers:
    - name: task-pv-container
      image: alpine:latest
      command:
        - /bin/sh
        - "-c"
        - "sleep 60m"
      volumeMounts:
        - mountPath: "/data"
          name: mongo-storage

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;For the v0.2.0 deployment, this was as expected, the data is there.&lt;/li&gt;
&lt;li&gt;For the v0.5.1 deployment, there is no data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I deployed the both versions again and dropped the Kasten backup/restore steps.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deploy the version of code&lt;/li&gt;
&lt;li&gt;Play Pac-Man, save highscore&lt;/li&gt;
&lt;li&gt;Set Mongo Deployment replicas to zero&lt;/li&gt;
&lt;li&gt;Spin up a test pod and connect to the PVC/PV.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Confirmed same behaviour.&lt;/p&gt;

&lt;p&gt;A few other checks I ran to ensure the volumes were being mounted correctly:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get pod,vpc,pv -n pacman

NAME READY STATUS RESTARTS AGE
pod/mongo-bdbcc7c7f-hlz6r 1/1 Running 0 77m
pod/pacman-5dd85445bc-bvqv9 1/1 Running 1 2d3h

NAME STATUS VOLUME CAPACITY ACCESS MODES STORAGECLASS AGE
persistentvolumeclaim/mongo-storage Bound pvc-36fac4ef-a09a-4cd2-b03f-eaf09c442768 1Gi RWO csi-sc-vmc 2d3h

NAME CAPACITY ACCESS MODES RECLAIM POLICY STATUS CLAIM STORAGECLASS REASON AGE
persistentvolume/pvc-36fac4ef-a09a-4cd2-b03f-eaf09c442768 1Gi RWO Delete Bound pacman-052/mongo-storage csi-sc-vmc 2d3h

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The Pac-Man NodeJS container also has some basic logging, we could see here the a successful insert of a new high score to the database.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;kubectl get logs pacman-5dd85445bc-bvqv9 -n pacman

&amp;gt; pacman@0.0.1 start /usr/src/app
&amp;gt; node .

Listening on port 8080
Connected to database server successfully
Time: Thu Aug 26 2021 16:20:02 GMT+0000 (UTC)
[GET /highscores/list]
Time: Thu Aug 26 2021 16:20:02 GMT+0000 (UTC)
[GET /loc/metadata]
[getHost]
HOST: pacman-5dd85445bc-bvqv9
getCloudMetadata
getK8sCloudMetadata
Querying tkg-wld-01-md-0-54598b8d99-89498 for cloud data
Request Failed.
Status Code: 403
getAWSCloudMetadata
Time: Thu Aug 26 2021 16:20:02 GMT+0000 (UTC)
[GET /user/id]
Successfully inserted new user ID = 6127bf321c074a0011281673
Time: Thu Aug 26 2021 16:20:14 GMT+0000 (UTC)
[POST /highscores] body = { name: '052',
 cloud: '',
 zone: '',
 host: '',
 score: '100',
 level: '1' } host = 192.168.200.51 user-agent = Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36 referer = [http://192.168.200.51/](http://192.168.200.51/)
Successfully inserted highscore
problem with request: connect ETIMEDOUT 169.254.169.254:80
getAzureCloudMetadata
problem with request: connect ETIMEDOUT 169.254.169.254:80
getGCPCloudMetadata
problem with request: getaddrinfo ENOTFOUND metadata.google.internal metadata.google.internal:80
getOpenStackCloudMetadata
problem with request: connect ETIMEDOUT 169.254.169.254:80
CLOUD: unknown
ZONE: unknown
HOST: pacman-5dd85445bc-bvqv9
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And then finally, I checked to see the high score in Mongo by getting a shell to the Mongo container (command above):&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@mongo-bdbcc7c7f-hlz6r:/data/db$ mongo 127.0.0.1:27017/pacman -u blinky -p pinky
MongoDB shell version v4.4.8
connecting to: [mongodb://127.0.0.1:27017/pacman?compressors=disabled&amp;amp;gssapiServiceName=mongodb](mongodb://127.0.0.1:27017/pacman?compressors=disabled&amp;amp;gssapiServiceName=mongodb)
Implicit session: session { "id" : UUID("a839cb26-0d6e-41ef-a730-c82ccfd3897d") }
MongoDB server version: 4.4.8
&amp;gt; show dbs
pacman 0.000GB
&amp;gt; use pacman
switched to db pacman
&amp;gt; show collections
highscore
userstats
&amp;gt; coll = db.highscore
pacman.highscore
&amp;gt; coll.find()
{ "_id" : ObjectId("6127bf3e1c074a0011281674"), "name" : "052", "cloud" : "", "zone" : "", "host" : "", "score" : 100, "level" : 1, "date" : "Thu Aug 26 2021 16:20:14 GMT+0000 (UTC)", "referer" : "[http://192.168.200.51/](http://192.168.200.51/)", "user_agent" : "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.107 Safari/537.36", "hostname" : "192.168.200.51", "ip_addr" : "::ffff:100.96.2.1" }
&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h6&gt;
  
  
  Attempting to fix the issue by changing container image
&lt;/h6&gt;

&lt;p&gt;After discussing the issue with a few people in “virtual passing” (because there’s no more corridor discussions when you work from home). I decided to mix things up and change the image, as everything else in the YAMLs looks correct, just MongoDB isn’t writing to disk, maybe it’s a bug in the version in use, plus it was MongoDB 3.6, I should probably try a newer release if possible.&lt;/p&gt;

&lt;p&gt;With that, I looked at the official Mongo container, but it’s packaging is &lt;a href="https://github.com/docker-library/mongo/issues/174"&gt;pretty pants&lt;/a&gt;, in terms of initialising it for first use and available options.&lt;/p&gt;

&lt;p&gt;I decided to move the image to the &lt;a href="https://github.com/bitnami/bitnami-docker-mongodb"&gt;Bitnami MongoDB image&lt;/a&gt;.&lt;/p&gt;

&lt;h6&gt;
  
  
  Moving to the Bitnami Image
&lt;/h6&gt;

&lt;p&gt;I moved over to the Bitnami MongoDB image, the read me file in GitHub is well produced.&lt;/p&gt;

&lt;p&gt;I just swapped out the image in my YAML and expected it to work. I did not. Same behaviour.&lt;/p&gt;

&lt;p&gt;I consulted another friend on the issue, and he asked one simple question, and everything fell into place:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“Can you check the mongodb config file and make sure the data source is /data/db?”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So off I went to google where the config file is located on the container image, (rather than you know, pay attention to the &lt;a href="https://github.com/bitnami/bitnami-docker-mongodb#configuration-file"&gt;documentation&lt;/a&gt;). So that I could check the default location of where it expects the mount point to be for the storing the database files.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Default MongoDB Config file for Bitnami image
/opt/bitnami/mongodb/conf/

# If you are providing your own config file, use a mount point here
/bitnami/mongodb/conf
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Anyhow low and behold, the default path for the database files in the Bitnami image is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/bitnami/mongodb/data/db
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I also verified the issue by looking at the logs on the container:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;{"t":{"$date":"2021-08-26T20:41:33.593+00:00"},"s":"E", "c":"STORAGE", "id":20557, "ctx":"initandlisten","msg":"DBException in initAndListen, terminating","attr":{"error":"IllegalOperation: Attempted to create a lock file on a read-only directory: /bitnami/mongodb/data/db"}}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h6&gt;
  
  
  Fixing the volume mount issue and nearly winning
&lt;/h6&gt;

&lt;p&gt;So I changed my Deployment file to the &lt;a href="https://github.com/saintdle/pacman-tanzu/blob/9ea19fc579c7ae12f0a41c90508b1975c30e2b31/deployments/mongo-deployment.yaml#L86"&gt;correct Volume Mount Point&lt;/a&gt;, and redeployed. This time I went straight to the logs, and I saw another error:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# k logs mongo-9c9dcf58d-47rf6 
mongodb 20:49:49.44 
mongodb 20:49:49.44 Welcome to the Bitnami mongodb container
mongodb 20:49:49.45 Subscribe to project updates by watching https://github.com/bitnami/bitnami-docker-mongodb
mongodb 20:49:49.45 Submit issues and feature requests at https://github.com/bitnami/bitnami-docker-mongodb/issues
mongodb 20:49:49.45 
mongodb 20:49:49.45 INFO ==&amp;gt; **Starting MongoDB setup**
mongodb 20:49:49.47 INFO ==&amp;gt; Validating settings in MONGODB_* env vars...
mongodb 20:49:49.48 INFO ==&amp;gt; Initializing MongoDB...
mongodb 20:49:49.50 INFO ==&amp;gt; Deploying MongoDB from scratch...
mkdir: cannot create directory '/bitnami/mongodb/data/db': Permission denied
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;OK this isn’t good! Another hurdle to jump through.&lt;/p&gt;

&lt;h6&gt;
  
  
  Fixing the Permission Issue
&lt;/h6&gt;

&lt;p&gt;The Bitnami MongoDB container image is a non-root image, meaning it doesn’t have the writes to set its permissions on the mounted file system. This is provide a more secure deployment. And helpfully I found &lt;a href="https://docs.bitnami.com/general/how-to/troubleshoot-helm-chart-issues/#permission-errors-when-enabling-persistence"&gt;listed in this Bitnami documentation&lt;/a&gt;, which also pointed me to the fix &amp;gt; &lt;a href="https://kubernetes.io/docs/concepts/workloads/pods/init-containers/"&gt;Init Container&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;If you deploy the Bitnami MongoDB image using helm, the deployment uses an Init Container to run the necessary root level commands to prepare the environment, in this case my Persistent Volume, before running the main container. An Init Container is short lived for its prescribed task.&lt;/p&gt;

&lt;p&gt;So I cheated ever so slightly, I ran a Helm deployment of the Bitnami image, and looking at how they were achieving this using an Init container, and anything else I might have missed (by this point my files were pretty complete unless I wanted to add some liveness probes).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;helm repo add bitnami https://charts.bitnami.com/bitnami

helm install bitmongotest bitnami/mongodb --set volumePermissions.enabled=true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I then &lt;a href="https://github.com/saintdle/pacman-tanzu/blob/9ea19fc579c7ae12f0a41c90508b1975c30e2b31/deployments/mongo-deployment.yaml#L19"&gt;cloned over the Init Container&lt;/a&gt; details to my deployment files, taking careful note to change things like the Service Accounts referenced and the PVC names.&lt;/p&gt;

&lt;h6&gt;
  
  
  Wrap Up
&lt;/h6&gt;

&lt;p&gt;After using the Init Container to set the permissions, I found all my testing successful once again.&lt;/p&gt;

&lt;p&gt;During this process I did actually realise by the time I hit the Bitnami mount point issue, what my issue was with Original MongoDB with Auth deployment was (in branch v0.5.0). The same thing, the volume mount point. I was using a different image of Mongo in this commit, as setting up Auth was a lot easier in this version, for the same reasons mentioned earlier in the post about using the Official MongoDB container.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://github.com/saintdle/pacman-k8s/blob/b382e9f4f24d124f6a5f8338ffb734fa63e50f2d/02_pacman-mongo-apps.yaml#L66"&gt;Example of correct&lt;/a&gt; Centos/mongodb-36-centos-7 mount point
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        volumeMounts:
        - mountPath: /var/lib/mongodb/data
          name: mongodb-data

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, I decided to continue down the Bitnami MongoDB image path by this point, as I wanted to use a newer version of MongoDB. I put my issues down to experience, as I develop my skills and knowledge of Kubernetes, and applications themselves. If I had taken a step back to thing about things logically, I might have hit earlier on the point that maybe the DB configuration had the wrong location to store the data.&lt;/p&gt;

&lt;p&gt;Hopefully this blog post is useful anyone reading, I just wanted to document out my troubleshooting steps, and what I tested. Who knows, I might forget all this, and encounter the same issue again, and find my blog whilst googling (it’s happened before).&lt;/p&gt;

&lt;p&gt;I’ve updated my GitHub Repo, and everything from this post is captured as the working output in &lt;a href="https://github.com/saintdle/pacman-tanzu/tree/v0.5.2"&gt;Branch v0.5.2&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Regards&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/saintdle"&gt;Follow @Saintdle&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://uk.linkedin.com/in/saintdle?trk=profile-badge"&gt;Dean Lewis&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The post &lt;a href="https://veducate.co.uk/mongodb-data-loss/"&gt;MongoDB Container data loss issue – A Journey&lt;/a&gt; appeared first on &lt;a href="https://veducate.co.uk"&gt;vEducate.co.uk&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>kubernetes</category>
      <category>bitnami</category>
      <category>dataloss</category>
      <category>mongodb</category>
    </item>
  </channel>
</rss>
