For a very trivial example, let $X$ be any set, and let $d$ be the discrete metric on $X$; $d(x,y)=0$ if $x=y$, and $d(x,y)=1$ otherwise. Clearly this $d$ is an ultrametric, and it generates the discrete topology.
For a much more interesting example, let $D=\{0,1\}$ with the discrete topology, and let $X=D^{\Bbb N}$, the Cartesian product of countably infinitely many copies of $D$. Elements of $X$ are sequences $x=\langle x_n:n\in\Bbb N\rangle$ such that each $x_n$ is either $0$ or $1$. (This space is homeomorphic to the well-known middle-thirds Cantor set.)
For distinct $x,y\in X$ let $\delta(x,y)=\min\{n\in\Bbb N:x_n\ne y_n\}$, the first index at which $x$ and $y$ disagree. We can define a metric $d$ on $X$ by setting
$$d(x,y)=\begin{cases}
0,&\text{if }x=y\\
2^{-\delta(x,y)},&\text{otherwise}\;.
\end{cases}$$
In words, $d$ ‘says’ that if $x$ and $y$ agree on their first $n$ terms, then $d(x,y)$ is at most $\frac1{2^n}$.
It’s clear that $d$ is symmetric and separates points. Now let $x,y,z\in X$; we want to show that
$$d(x,y)\le\max\{d(x,z),d(z,y)\}\;.$$
This is clear if $x=z$, $y=z$, or $x=y$, so assume that the three points are distinct. Let $k=\delta(x,z)$ and $\ell=\delta(z,y)$, and without loss of generality assume that $k\le\ell$. Then $x_n=z_n=y_n$ for each $n<k$, so $\delta(x,y)\ge k$, and therefore
$$d(x,y)=2^{-\delta(x,y)}\le 2^{-k}=\max\left\{2^{-k},2^{-\ell}\right\}=\max\{d(x,z),d(z,y)\}\;,$$
and $d$ is an ultrametric.
I’ll leave it as an exercise, if you’re interested, to show that $d$ generates the product topology on $X$.